We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d08c25 commit ce06a06Copy full SHA for ce06a06
CheckboxDemoApp/CheckboxButton.swift
@@ -9,5 +9,18 @@ import UIKit
9
10
final class CheckboxButton: UIButton {
11
12
- // Implemente a sua solução aqui
+ private let selectedImage = UIImage(systemName: "checkmark.square.fill")
13
+ private let unselectedImage = UIImage(systemName: "square")
14
+
15
+ convenience init() {
16
+ self.init(frame: .zero)
17
+ tintColor = .red
18
+ setImage(unselectedImage, for: .normal)
19
+ setImage(selectedImage, for: .selected)
20
+ addTarget(self, action: #selector(checkboxDidTouchUpInsideActionHandler), for: .touchUpInside)
21
+ }
22
23
+ @objc private func checkboxDidTouchUpInsideActionHandler(_ button: UIButton) {
24
+ button.isSelected.toggle()
25
26
}
0 commit comments