@@ -57,20 +57,21 @@ final class DogetherTodoItem: UIButton {
57
57
$0. height. equalTo ( 64 )
58
58
}
59
59
60
- if todo. status != . waitCertificattion {
60
+ if todo. status != TodoStatus . waitCertificattion. rawValue {
61
+ let imageSize = todo. status == TodoStatus . waitExamination. rawValue ? 22 : todo. status == TodoStatus . reject. rawValue ? 26 : 28 // MARK: 임의로 사이즈 조정
61
62
todoImageView. snp. makeConstraints {
62
63
$0. centerY. equalToSuperview ( )
63
64
$0. left. equalToSuperview ( ) . offset ( 16 )
64
- $0. width. height. equalTo ( todo . status == . waitExamination ? 22 : todo . status == . reject ? 26 : 28 ) // MARK: 임의로 사이즈 조정
65
+ $0. width. height. equalTo ( imageSize )
65
66
}
66
67
}
67
68
68
69
contentLabel. snp. makeConstraints {
69
70
$0. centerY. equalToSuperview ( )
70
71
$0. left. equalTo (
71
- todo. status == . waitCertificattion ? dogetherTodoItem : todoImageView. snp. right
72
+ todo. status == TodoStatus . waitCertificattion. rawValue ? dogetherTodoItem : todoImageView. snp. right
72
73
) . offset (
73
- todo. status == . waitCertificattion ? 16 : 8
74
+ todo. status == TodoStatus . waitCertificattion. rawValue ? 16 : 8
74
75
)
75
76
}
76
77
@@ -83,25 +84,26 @@ final class DogetherTodoItem: UIButton {
83
84
}
84
85
85
86
func updateTodoStatus( _ status: TodoStatus ) {
86
- self . todo. status = status
87
+ self . todo. status = status. rawValue
87
88
updateUI ( )
88
89
}
89
90
90
91
private func updateUI( ) {
91
- todoImageView. image = todo. status. image
92
- if todo. status == . waitCertificattion {
92
+ guard let status = TodoStatus ( rawValue: todo. status) else { return }
93
+ todoImageView. image = status. image
94
+ if status == . waitCertificattion {
93
95
contentLabel. text = todo. content
94
96
} else {
95
97
let attributes : [ NSAttributedString . Key : Any ] = [
96
98
. strikethroughStyle: NSUnderlineStyle . single. rawValue,
97
- . strikethroughColor: todo . status. contentColor
99
+ . strikethroughColor: status. contentColor
98
100
]
99
101
contentLabel. attributedText = NSAttributedString ( string: todo. content, attributes: attributes)
100
102
}
101
- contentLabel. textColor = todo . status. contentColor
102
- buttonLabel. text = todo . status. buttonText
103
- buttonLabel. textColor = todo . status. buttonTextColor
104
- buttonLabel. backgroundColor = todo . status. buttonColor
103
+ contentLabel. textColor = status. contentColor
104
+ buttonLabel. text = status. buttonText
105
+ buttonLabel. textColor = status. buttonTextColor
106
+ buttonLabel. backgroundColor = status. buttonColor
105
107
}
106
108
107
109
@objc private func didTapTodoItem( ) {
0 commit comments