Showing
15 changed files
with
214 additions
and
34 deletions
| @@ -27,7 +27,7 @@ extension UIColor { | @@ -27,7 +27,7 @@ extension UIColor { | ||
| 27 | 27 | ||
| 28 | } | 28 | } |
| 29 | extension CGColor { | 29 | extension CGColor { |
| 30 | - enum ButtonBorderColor { | 30 | + enum BorderColor { |
| 31 | static let lightGrey = UIColor(named: "LightGreyBorderColor")?.cgColor | 31 | static let lightGrey = UIColor(named: "LightGreyBorderColor")?.cgColor |
| 32 | static let lightBlue = UIColor(named: "LightBlueBorderColor")?.cgColor | 32 | static let lightBlue = UIColor(named: "LightBlueBorderColor")?.cgColor |
| 33 | } | 33 | } |
| @@ -31,6 +31,7 @@ | @@ -31,6 +31,7 @@ | ||
| 31 | 1738F7D82850F5D5003F1806 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1738F7D72850F5D5003F1806 /* SettingsViewController.swift */; }; | 31 | 1738F7D82850F5D5003F1806 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1738F7D72850F5D5003F1806 /* SettingsViewController.swift */; }; |
| 32 | 1738F7DA2850F5F1003F1806 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1738F7D92850F5F1003F1806 /* SettingsView.swift */; }; | 32 | 1738F7DA2850F5F1003F1806 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1738F7D92850F5F1003F1806 /* SettingsView.swift */; }; |
| 33 | 175DA474285241C90075F0A9 /* SettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 175DA473285241C90075F0A9 /* SettingsModel.swift */; }; | 33 | 175DA474285241C90075F0A9 /* SettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 175DA473285241C90075F0A9 /* SettingsModel.swift */; }; |
| 34 | + 1763F7FC2861FFFD005D988C /* ResidentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1763F7FB2861FFFD005D988C /* ResidentTableViewCell.swift */; }; | ||
| 34 | 17ABE070285B80DC0006E7EC /* DisplayNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */; }; | 35 | 17ABE070285B80DC0006E7EC /* DisplayNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */; }; |
| 35 | 17ABE072285B810F0006E7EC /* SettingsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE071285B810F0006E7EC /* SettingsTableViewCell.swift */; }; | 36 | 17ABE072285B810F0006E7EC /* SettingsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE071285B810F0006E7EC /* SettingsTableViewCell.swift */; }; |
| 36 | 17ABE074285B81390006E7EC /* SettingsSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE073285B81390006E7EC /* SettingsSwitchCell.swift */; }; | 37 | 17ABE074285B81390006E7EC /* SettingsSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE073285B81390006E7EC /* SettingsSwitchCell.swift */; }; |
| @@ -75,6 +76,7 @@ | @@ -75,6 +76,7 @@ | ||
| 75 | 1738F7D72850F5D5003F1806 /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; }; | 76 | 1738F7D72850F5D5003F1806 /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; }; |
| 76 | 1738F7D92850F5F1003F1806 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; }; | 77 | 1738F7D92850F5F1003F1806 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; }; |
| 77 | 175DA473285241C90075F0A9 /* SettingsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsModel.swift; sourceTree = "<group>"; }; | 78 | 175DA473285241C90075F0A9 /* SettingsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsModel.swift; sourceTree = "<group>"; }; |
| 79 | + 1763F7FB2861FFFD005D988C /* ResidentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResidentTableViewCell.swift; sourceTree = "<group>"; }; | ||
| 78 | 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayNameCell.swift; sourceTree = "<group>"; }; | 80 | 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayNameCell.swift; sourceTree = "<group>"; }; |
| 79 | 17ABE071285B810F0006E7EC /* SettingsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTableViewCell.swift; sourceTree = "<group>"; }; | 81 | 17ABE071285B810F0006E7EC /* SettingsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTableViewCell.swift; sourceTree = "<group>"; }; |
| 80 | 17ABE073285B81390006E7EC /* SettingsSwitchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSwitchCell.swift; sourceTree = "<group>"; }; | 82 | 17ABE073285B81390006E7EC /* SettingsSwitchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSwitchCell.swift; sourceTree = "<group>"; }; |
| @@ -315,6 +317,14 @@ | @@ -315,6 +317,14 @@ | ||
| 315 | path = Cells; | 317 | path = Cells; |
| 316 | sourceTree = "<group>"; | 318 | sourceTree = "<group>"; |
| 317 | }; | 319 | }; |
| 320 | + 1763F7FA2861FFB0005D988C /* ResidentTableViewCell */ = { | ||
| 321 | + isa = PBXGroup; | ||
| 322 | + children = ( | ||
| 323 | + 1763F7FB2861FFFD005D988C /* ResidentTableViewCell.swift */, | ||
| 324 | + ); | ||
| 325 | + path = ResidentTableViewCell; | ||
| 326 | + sourceTree = "<group>"; | ||
| 327 | + }; | ||
| 318 | 17ABFE54284FD1C8003B6959 /* HomeScreen */ = { | 328 | 17ABFE54284FD1C8003B6959 /* HomeScreen */ = { |
| 319 | isa = PBXGroup; | 329 | isa = PBXGroup; |
| 320 | children = ( | 330 | children = ( |
| @@ -335,8 +345,8 @@ | @@ -335,8 +345,8 @@ | ||
| 335 | 17ABFE56284FD1F5003B6959 /* VIew */ = { | 345 | 17ABFE56284FD1F5003B6959 /* VIew */ = { |
| 336 | isa = PBXGroup; | 346 | isa = PBXGroup; |
| 337 | children = ( | 347 | children = ( |
| 338 | - 00A48B6F285F8E8200EF0A08 /* Cell */, | ||
| 339 | 17ABFE59284FD293003B6959 /* HomeView.swift */, | 348 | 17ABFE59284FD293003B6959 /* HomeView.swift */, |
| 349 | + 00A48B6F285F8E8200EF0A08 /* Cell */, | ||
| 340 | ); | 350 | ); |
| 341 | path = VIew; | 351 | path = VIew; |
| 342 | sourceTree = "<group>"; | 352 | sourceTree = "<group>"; |
| @@ -396,6 +406,7 @@ | @@ -396,6 +406,7 @@ | ||
| 396 | isa = PBXGroup; | 406 | isa = PBXGroup; |
| 397 | children = ( | 407 | children = ( |
| 398 | 17CD09AB2858F9B0008483E2 /* ResidentsView.swift */, | 408 | 17CD09AB2858F9B0008483E2 /* ResidentsView.swift */, |
| 409 | + 1763F7FA2861FFB0005D988C /* ResidentTableViewCell */, | ||
| 399 | ); | 410 | ); |
| 400 | path = View; | 411 | path = View; |
| 401 | sourceTree = "<group>"; | 412 | sourceTree = "<group>"; |
| @@ -609,6 +620,7 @@ | @@ -609,6 +620,7 @@ | ||
| 609 | 00A48B6C285F8CEA00EF0A08 /* AddResidentsViewController.swift in Sources */, | 620 | 00A48B6C285F8CEA00EF0A08 /* AddResidentsViewController.swift in Sources */, |
| 610 | 175DA474285241C90075F0A9 /* SettingsModel.swift in Sources */, | 621 | 175DA474285241C90075F0A9 /* SettingsModel.swift in Sources */, |
| 611 | 17CF9EE12844ED8F000D8077 /* AppDelegate.swift in Sources */, | 622 | 17CF9EE12844ED8F000D8077 /* AppDelegate.swift in Sources */, |
| 623 | + 1763F7FC2861FFFD005D988C /* ResidentTableViewCell.swift in Sources */, | ||
| 612 | 00A48B62285F8CDD00EF0A08 /* CodeVerificationView.swift in Sources */, | 624 | 00A48B62285F8CDD00EF0A08 /* CodeVerificationView.swift in Sources */, |
| 613 | 17CD09A42858EE39008483E2 /* ChooseApartmentsTableViewCell.swift in Sources */, | 625 | 17CD09A42858EE39008483E2 /* ChooseApartmentsTableViewCell.swift in Sources */, |
| 614 | 1729E21D28465163006C7C29 /* PhoneService.swift in Sources */, | 626 | 1729E21D28465163006C7C29 /* PhoneService.swift in Sources */, |
| @@ -14,7 +14,7 @@ class SquereCheckbox: UIButton { | @@ -14,7 +14,7 @@ class SquereCheckbox: UIButton { | ||
| 14 | 14 | ||
| 15 | private let checkBoxLabel: UILabel = { | 15 | private let checkBoxLabel: UILabel = { |
| 16 | let obj = UILabel() | 16 | let obj = UILabel() |
| 17 | - obj.font = .skModernist(type: .regular, ofSize: 14) | 17 | + obj.font = .skModernist(type: .regular, ofSize: 12) |
| 18 | return obj | 18 | return obj |
| 19 | }() | 19 | }() |
| 20 | 20 |
| @@ -47,7 +47,7 @@ class AddResidentsView: UIView { | @@ -47,7 +47,7 @@ class AddResidentsView: UIView { | ||
| 47 | var obj = UIButton() | 47 | var obj = UIButton() |
| 48 | obj.layer.cornerRadius = 13 | 48 | obj.layer.cornerRadius = 13 |
| 49 | obj.layer.borderWidth = 1 | 49 | obj.layer.borderWidth = 1 |
| 50 | - obj.layer.borderColor = .ButtonBorderColor.lightGrey | 50 | + obj.layer.borderColor = .BorderColor.lightGrey |
| 51 | obj.setImage(UIImage(named: "Close"), for: .normal) | 51 | obj.setImage(UIImage(named: "Close"), for: .normal) |
| 52 | return obj | 52 | return obj |
| 53 | }() | 53 | }() |
| @@ -9,8 +9,6 @@ import UIKit | @@ -9,8 +9,6 @@ import UIKit | ||
| 9 | import ContactsUI | 9 | import ContactsUI |
| 10 | 10 | ||
| 11 | class AddResidentsViewController: UIViewController { | 11 | class AddResidentsViewController: UIViewController { |
| 12 | -// var myData: ResidentModel? | ||
| 13 | - | ||
| 14 | var savedResidents: [ResidentModel] = [] | 12 | var savedResidents: [ResidentModel] = [] |
| 15 | 13 | ||
| 16 | weak var delegate: ResidentSavable? | 14 | weak var delegate: ResidentSavable? |
| @@ -54,11 +52,6 @@ class AddResidentsViewController: UIViewController { | @@ -54,11 +52,6 @@ class AddResidentsViewController: UIViewController { | ||
| 54 | NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) | 52 | NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) |
| 55 | } | 53 | } |
| 56 | 54 | ||
| 57 | - @objc private func gestureFired() { | ||
| 58 | - print("❌") | ||
| 59 | - | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | func reloadView() { | 55 | func reloadView() { |
| 63 | mainView.mobileNumberTextField.reloadInputViews() | 56 | mainView.mobileNumberTextField.reloadInputViews() |
| 64 | } | 57 | } |
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | import UIKit | 8 | import UIKit |
| 9 | 9 | ||
| 10 | class ChooseApartmentsTableViewCell: UITableViewCell { | 10 | class ChooseApartmentsTableViewCell: UITableViewCell { |
| 11 | - static let id = "ChooseApartmentsTableViewCell-ID" | 11 | + static let id = String(describing: ChooseApartmentsTableViewCell.self) |
| 12 | 12 | ||
| 13 | var apartmanImage: UIImageView = { | 13 | var apartmanImage: UIImageView = { |
| 14 | var obj = UIImageView() | 14 | var obj = UIImageView() |
| @@ -14,7 +14,7 @@ class HomeTableViewCell: UITableViewCell { | @@ -14,7 +14,7 @@ class HomeTableViewCell: UITableViewCell { | ||
| 14 | var obj = UIView() | 14 | var obj = UIView() |
| 15 | obj.layer.cornerRadius = 15 | 15 | obj.layer.cornerRadius = 15 |
| 16 | obj.layer.borderWidth = 1 | 16 | obj.layer.borderWidth = 1 |
| 17 | - obj.layer.borderColor = UIColor(red: 0.89, green: 0.918, blue: 0.918, alpha: 1).cgColor | 17 | + obj.layer.borderColor = .BorderColor.lightGrey |
| 18 | return obj | 18 | return obj |
| 19 | }() | 19 | }() |
| 20 | 20 | ||
| @@ -28,14 +28,14 @@ class HomeTableViewCell: UITableViewCell { | @@ -28,14 +28,14 @@ class HomeTableViewCell: UITableViewCell { | ||
| 28 | var doorNameLabel: UILabel = { | 28 | var doorNameLabel: UILabel = { |
| 29 | var obj = UILabel() | 29 | var obj = UILabel() |
| 30 | obj.font = .skModernist(type: .bold, ofSize: 16) | 30 | obj.font = .skModernist(type: .bold, ofSize: 16) |
| 31 | - obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1) | 31 | + obj.textColor = .TextColor.darkBlue |
| 32 | obj.text = "Front Door" | 32 | obj.text = "Front Door" |
| 33 | return obj | 33 | return obj |
| 34 | }() | 34 | }() |
| 35 | 35 | ||
| 36 | var doorLocationLabel: UILabel = { | 36 | var doorLocationLabel: UILabel = { |
| 37 | var obj = UILabel() | 37 | var obj = UILabel() |
| 38 | - obj.textColor = UIColor(red: 0.725, green: 0.725, blue: 0.725, alpha: 1) | 38 | + obj.textColor = .TextColor.lightGrey |
| 39 | obj.font = .skModernist(type: .regular, ofSize: 14) | 39 | obj.font = .skModernist(type: .regular, ofSize: 14) |
| 40 | obj.text = "Home" | 40 | obj.text = "Home" |
| 41 | return obj | 41 | return obj |
| @@ -20,10 +20,10 @@ class HomeViewController: UIViewController { | @@ -20,10 +20,10 @@ class HomeViewController: UIViewController { | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | private func initViewController() { | 22 | private func initViewController() { |
| 23 | - mainView.settingsButton.addTarget(self, action: #selector(didShowSettingsVC), for: .touchUpInside) | ||
| 24 | mainView.tableView.delegate = self | 23 | mainView.tableView.delegate = self |
| 25 | mainView.tableView.dataSource = self | 24 | mainView.tableView.dataSource = self |
| 26 | mainView.tableView.register(HomeTableViewCell.self, forCellReuseIdentifier: HomeTableViewCell.id) | 25 | mainView.tableView.register(HomeTableViewCell.self, forCellReuseIdentifier: HomeTableViewCell.id) |
| 26 | + mainView.settingsButton.addTarget(self, action: #selector(didShowSettingsVC), for: .touchUpInside) | ||
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| 29 | 29 |
InterQR-Internship/Modules/ResidentsScreen/View/ResidentTableViewCell/ResidentTableViewCell.swift
0 → 100644
| 1 | +// | ||
| 2 | +// ResidentTableViewCell.swift | ||
| 3 | +// InterQR-Internship | ||
| 4 | +// | ||
| 5 | +// Created by Дмитрий Тимофеев on 21.06.2022. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import UIKit | ||
| 9 | + | ||
| 10 | +class ResidentTableViewCell: UITableViewCell { | ||
| 11 | + static let id = String(describing: ResidentTableViewCell.self) | ||
| 12 | + | ||
| 13 | + var containerView: UIView = { | ||
| 14 | + var obj = UIView() | ||
| 15 | + obj.layer.cornerRadius = 15 | ||
| 16 | + obj.layer.borderWidth = 1 | ||
| 17 | + obj.layer.borderColor = .BorderColor.lightGrey | ||
| 18 | + return obj | ||
| 19 | + }() | ||
| 20 | + | ||
| 21 | + var serialNumberView: UIImageView = { | ||
| 22 | + let obj = UIImageView() | ||
| 23 | + obj.layer.cornerRadius = 21.5 | ||
| 24 | + obj.backgroundColor = .blue | ||
| 25 | + return obj | ||
| 26 | + }() | ||
| 27 | + | ||
| 28 | + var serialNumberLabel: UILabel = { | ||
| 29 | + let obj = UILabel() | ||
| 30 | + obj.font = .skModernist(type: .bold, ofSize: 14) | ||
| 31 | + obj.textColor = .white | ||
| 32 | + return obj | ||
| 33 | + }() | ||
| 34 | + | ||
| 35 | + var nameLabel: UILabel = { | ||
| 36 | + var obj = UILabel() | ||
| 37 | + obj.textColor = .TextColor.darkBlue | ||
| 38 | + obj.font = .skModernist(type: .bold, ofSize: 16) | ||
| 39 | + obj.text = "John Doe" | ||
| 40 | + return obj | ||
| 41 | + }() | ||
| 42 | + | ||
| 43 | + var phoneNumberLabel: UILabel = { | ||
| 44 | + var obj = UILabel() | ||
| 45 | + obj.textColor = .TextColor.lightGrey | ||
| 46 | + obj.font = .skModernist(type: .regular, ofSize: 14) | ||
| 47 | + obj.text = "+38095" | ||
| 48 | + return obj | ||
| 49 | + }() | ||
| 50 | + | ||
| 51 | + var managerButton: SquereCheckbox = { | ||
| 52 | + var obj = SquereCheckbox() | ||
| 53 | + obj.checkboxTitle = "Manager" | ||
| 54 | + obj.setTitleColor(.TextColor.lightGrey, for: .normal) | ||
| 55 | + obj.setTitleColor(.TextColor.darkBlue, for: .selected) | ||
| 56 | + obj.isSelected = false | ||
| 57 | + return obj | ||
| 58 | + }() | ||
| 59 | + | ||
| 60 | + var hiddenButton: SquereCheckbox = { | ||
| 61 | + var obj = SquereCheckbox() | ||
| 62 | + obj.checkboxTitle = "Hidden" | ||
| 63 | + obj.setTitleColor(.TextColor.lightGrey, for: .normal) | ||
| 64 | + obj.setTitleColor(.TextColor.darkBlue, for: .selected) | ||
| 65 | + obj.isSelected = false | ||
| 66 | + return obj | ||
| 67 | + }() | ||
| 68 | + | ||
| 69 | + var heartButton: UIButton = { | ||
| 70 | + var obj = UIButton() | ||
| 71 | + obj.setImage(UIImage(named: "Heart"), for: .normal) | ||
| 72 | + obj.setImage(UIImage(named: "RedHeart"), for: .selected) | ||
| 73 | + return obj | ||
| 74 | + }() | ||
| 75 | + | ||
| 76 | + var removeCellButton: UIButton = { | ||
| 77 | + var obj = UIButton() | ||
| 78 | + obj.setImage(UIImage(named: "Bin"), for: .normal) | ||
| 79 | + return obj | ||
| 80 | + }() | ||
| 81 | + | ||
| 82 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 83 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 84 | + layout() | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + required init?(coder: NSCoder) { | ||
| 88 | + fatalError("init(coder:) has not been implemented") | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + func layout() { | ||
| 92 | + selectionStyle = .none | ||
| 93 | + | ||
| 94 | + contentView.addSubview(containerView) | ||
| 95 | + containerView.addSubview(serialNumberView) | ||
| 96 | + serialNumberView.addSubview(serialNumberLabel) | ||
| 97 | + | ||
| 98 | + containerView.addSubview(nameLabel) | ||
| 99 | + containerView.addSubview(phoneNumberLabel) | ||
| 100 | + containerView.addSubview(managerButton) | ||
| 101 | + containerView.addSubview(hiddenButton) | ||
| 102 | + containerView.addSubview(heartButton) | ||
| 103 | + containerView.addSubview(removeCellButton) | ||
| 104 | + | ||
| 105 | + containerView.snp.makeConstraints { | ||
| 106 | + $0.leading.trailing.equalToSuperview().inset(25) | ||
| 107 | + $0.bottom.top.equalToSuperview().inset(8) | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + serialNumberView.snp.makeConstraints { | ||
| 111 | + $0.height.width.equalTo(41) | ||
| 112 | + $0.leading.equalToSuperview().offset(23) | ||
| 113 | + $0.top.equalToSuperview().offset(19) | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + serialNumberLabel.snp.makeConstraints { | ||
| 117 | + $0.centerX.centerY.equalToSuperview() | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + nameLabel.snp.makeConstraints { | ||
| 121 | + $0.leading.equalTo(serialNumberView.snp.trailing).offset(18) | ||
| 122 | + $0.top.equalToSuperview().offset(22) | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + removeCellButton.snp.makeConstraints { | ||
| 126 | + $0.centerY.equalTo(nameLabel.snp.centerY) | ||
| 127 | + $0.trailing.equalToSuperview().offset(-22.5) | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + phoneNumberLabel.snp.makeConstraints { | ||
| 131 | + $0.leading.equalTo(nameLabel.snp.leading) | ||
| 132 | + $0.top.equalTo(nameLabel.snp.bottom).offset(1) | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + managerButton.snp.makeConstraints { | ||
| 136 | + $0.top.equalTo(phoneNumberLabel.snp.bottom).offset(30) | ||
| 137 | + $0.leading.equalToSuperview().offset(24) | ||
| 138 | + $0.height.equalTo(20) | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + hiddenButton.snp.makeConstraints { | ||
| 142 | + $0.leading.equalTo(managerButton.snp.trailing).offset(23) | ||
| 143 | + $0.centerY.equalTo(managerButton) | ||
| 144 | + $0.height.equalTo(20) | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + heartButton.snp.makeConstraints { | ||
| 148 | + $0.centerY.equalTo(hiddenButton) | ||
| 149 | + $0.bottom.equalToSuperview().offset(-18) | ||
| 150 | + $0.trailing.equalToSuperview().offset(-22) | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | +} |
| @@ -13,7 +13,7 @@ class ResidentsView: UIView { | @@ -13,7 +13,7 @@ class ResidentsView: UIView { | ||
| 13 | var obj = UIButton() | 13 | var obj = UIButton() |
| 14 | obj.setImage(UIImage(named: "BackPointer"), for: .normal) | 14 | obj.setImage(UIImage(named: "BackPointer"), for: .normal) |
| 15 | obj.backgroundColor = .white | 15 | obj.backgroundColor = .white |
| 16 | - obj.layer.borderColor = UIColor(red: 224/255, green: 231/255, blue: 232/255, alpha: 1).cgColor | 16 | + obj.layer.borderColor = .BorderColor.lightGrey |
| 17 | obj.layer.cornerRadius = 13 | 17 | obj.layer.cornerRadius = 13 |
| 18 | obj.layer.borderWidth = 1 | 18 | obj.layer.borderWidth = 1 |
| 19 | return obj | 19 | return obj |
| @@ -56,9 +56,9 @@ class ResidentsView: UIView { | @@ -56,9 +56,9 @@ class ResidentsView: UIView { | ||
| 56 | 56 | ||
| 57 | let tableView: UITableView = { | 57 | let tableView: UITableView = { |
| 58 | let obj = UITableView() | 58 | let obj = UITableView() |
| 59 | - obj.allowsSelection = false | ||
| 60 | obj.showsVerticalScrollIndicator = false | 59 | obj.showsVerticalScrollIndicator = false |
| 61 | obj.separatorStyle = .none | 60 | obj.separatorStyle = .none |
| 61 | + obj.rowHeight = UITableView.automaticDimension | ||
| 62 | return obj | 62 | return obj |
| 63 | }() | 63 | }() |
| 64 | 64 | ||
| @@ -68,7 +68,6 @@ class ResidentsView: UIView { | @@ -68,7 +68,6 @@ class ResidentsView: UIView { | ||
| 68 | return obj | 68 | return obj |
| 69 | }() | 69 | }() |
| 70 | 70 | ||
| 71 | - | ||
| 72 | override init(frame: CGRect) { | 71 | override init(frame: CGRect) { |
| 73 | super.init(frame: frame) | 72 | super.init(frame: frame) |
| 74 | backgroundColor = .white | 73 | backgroundColor = .white |
| @@ -8,16 +8,27 @@ | @@ -8,16 +8,27 @@ | ||
| 8 | import UIKit | 8 | import UIKit |
| 9 | 9 | ||
| 10 | class ResidentsViewController: UIViewController { | 10 | class ResidentsViewController: UIViewController { |
| 11 | - | 11 | + var myData: ResidentModel? |
| 12 | var mainView = ResidentsView() | 12 | var mainView = ResidentsView() |
| 13 | - | 13 | + var addResidents = AddResidentsViewController() |
| 14 | override func loadView() { | 14 | override func loadView() { |
| 15 | view = mainView | 15 | view = mainView |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | override func viewDidLoad() { | 18 | override func viewDidLoad() { |
| 19 | + initViewController() | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + func initViewController() { | ||
| 23 | + mainView.tableView.delegate = self | ||
| 24 | + mainView.tableView.dataSource = self | ||
| 25 | + mainView.tableView.register(ResidentTableViewCell.self, forCellReuseIdentifier: ResidentTableViewCell.id) | ||
| 26 | + | ||
| 19 | mainView.backButton.addTarget(self, action: #selector(didShowChooseApartVC), for: .touchUpInside) | 27 | mainView.backButton.addTarget(self, action: #selector(didShowChooseApartVC), for: .touchUpInside) |
| 20 | mainView.addResidentsButton.addTarget(self, action: #selector(willShowAddResidentVC), for: .touchUpInside) | 28 | mainView.addResidentsButton.addTarget(self, action: #selector(willShowAddResidentVC), for: .touchUpInside) |
| 29 | + | ||
| 30 | + addResidents.delegate = self | ||
| 31 | + addResidents.didReceiveData() | ||
| 21 | } | 32 | } |
| 22 | 33 | ||
| 23 | @objc func didShowChooseApartVC() { | 34 | @objc func didShowChooseApartVC() { |
| @@ -33,4 +44,29 @@ class ResidentsViewController: UIViewController { | @@ -33,4 +44,29 @@ class ResidentsViewController: UIViewController { | ||
| 33 | vc.modalTransitionStyle = .crossDissolve | 44 | vc.modalTransitionStyle = .crossDissolve |
| 34 | present(vc, animated: true) | 45 | present(vc, animated: true) |
| 35 | } | 46 | } |
| 47 | + | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +//MARK: - TableView delegate & data source | ||
| 51 | +extension ResidentsViewController: UITableViewDelegate, UITableViewDataSource { | ||
| 52 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 53 | + 10 | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 57 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: ResidentTableViewCell.id, for: indexPath) as? ResidentTableViewCell else { return UITableViewCell() } | ||
| 58 | +// cell.configureWithItem(doors[indexPath.row]) | ||
| 59 | + cell.serialNumberLabel.text = "\(indexPath.row + 1)" | ||
| 60 | +// cell.nameLabel.text = myData?.name | ||
| 61 | +// cell.phoneNumberLabel.text = myData?.mobileNumber | ||
| 62 | + return cell | ||
| 63 | + } | ||
| 64 | +} | ||
| 65 | +//MARK: - Protocol delegate | ||
| 66 | +extension ResidentsViewController: ResidentSavable { | ||
| 67 | + func save(_ data: ResidentModel) { | ||
| 68 | +// mainView.residentsLabel.text = data.name | ||
| 69 | + mainView.residentsLabel.reloadInputViews() | ||
| 70 | + mainView.tableView.reloadData() | ||
| 71 | + } | ||
| 36 | } | 72 | } |
| @@ -46,25 +46,12 @@ class VerificationView: UIView { | @@ -46,25 +46,12 @@ class VerificationView: UIView { | ||
| 46 | var button = Checkbox() | 46 | var button = Checkbox() |
| 47 | button.checkboxTitle = "Email" | 47 | button.checkboxTitle = "Email" |
| 48 | button.isSelected = true | 48 | button.isSelected = true |
| 49 | -// button.setTitle("Email", for: .normal) | ||
| 50 | -// button.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | ||
| 51 | -// button.setTitleColor(UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1), for: .disabled) | ||
| 52 | -// button.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5) | ||
| 53 | -// button.setImage(UIImage(named: "OnIndicator"), for: .normal) | ||
| 54 | -// button.setImage(UIImage(named: "OffIndicator"), for: .selected) | ||
| 55 | -// button.contentMode = .left | ||
| 56 | return button | 49 | return button |
| 57 | }() | 50 | }() |
| 58 | 51 | ||
| 59 | var phoneNumberButton: Checkbox = { | 52 | var phoneNumberButton: Checkbox = { |
| 60 | var button = Checkbox() | 53 | var button = Checkbox() |
| 61 | button.checkboxTitle = "Phone Number" | 54 | button.checkboxTitle = "Phone Number" |
| 62 | -// button.setTitle("Phone Number", for: .normal) | ||
| 63 | -// button.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | ||
| 64 | -// button.setTitleColor(UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1), for: .disabled) | ||
| 65 | -// button.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5) | ||
| 66 | -// button.setImage(UIImage(named: "OnIndicator"), for: .selected) | ||
| 67 | -// button.setImage(UIImage(named: "OffIndicator"), for: .normal) | ||
| 68 | return button | 55 | return button |
| 69 | }() | 56 | }() |
| 70 | 57 |
Please
register
or
login
to post a comment