Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- extension UITableViewCell {
- @IBInspectable
- var checked: Bool {
- get { return detailTextLabel?.text?.count ?? 0 > 0}
- set(value) {
- detailTextLabel?.text = value ? "✔️" : ""
- }
- }
- }
- class SettiongAllowanceTableViewController: UITableViewController {
- override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- tableView.deselectRow(at: indexPath, animated: true)
- tableView.cellForRow(at: indexPath)?.checked = !(tableView.cellForRow(at: indexPath)?.checked ?? true)
- }
- }
- class SettiongAllowanceViewController: ViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- }
- /*
- // MARK: - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- // Get the new view controller using segue.destination.
- // Pass the selected object to the new view controller.
- }
- */
- }
Add Comment
Please, Sign In to add comment