This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateListController: UITableViewController { | |
| @IBOutlet weak var doneBarButton: UIBarButtonItem! | |
| @IBOutlet weak var nameTextField: UITextField! | |
| // .. | |
| // .. | |
| var chooseIconTapped = false | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| handleEmptyFields() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateListController: UITableViewController { | |
| @IBOutlet weak var doneBarButton: UIBarButtonItem! | |
| @IBOutlet weak var nameTextField: UITextField! | |
| lazy var iconImage: UIImageView = { | |
| let imgView = UIImageView() | |
| return imgView | |
| }() | |
| @IBOutlet weak var iconCellView: UIImageView! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol CreateListControllerDelegate: class { | |
| func didAddList(list: List) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension ViewController: CreateListControllerDelegate { | |
| func didAddList(list: List) { | |
| self.collectionView.performBatchUpdates({ | |
| let indexPath = IndexPath(row: lists.count - 1, section: 0) | |
| self.collectionView.insertItems(at: [indexPath]) | |
| }, completion: nil) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @objc func addNewList() { | |
| let storyboard = UIStoryboard(name: "CreateList", bundle: nil) | |
| guard let createListController = storyboard.instantiateViewController(withIdentifier: "CreateListController") as? CreateListController else { return } | |
| createListController.delegate = self // delegate connected | |
| let vc = UINavigationController(rootViewController: createListController) | |
| present(vc, animated: true, completion: nil) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public extension UIColor { | |
| convenience init(r: CGFloat, g: CGFloat, b: CGFloat) { | |
| self.init(red: r/255, green: g/255, blue: b/255, alpha: 1) | |
| } | |
| static var customBackgroundColor: UIColor = { | |
| return UIColor(r: 239, g: 239, b: 244) | |
| }() | |
| convenience init(hexString: String, alpha: CGFloat = 1) { | |
| assert(hexString[hexString.startIndex] == "#", "Expected hex string of format #RRGGBB") | |
| let scanner = Scanner(string: hexString) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @IBDesignable | |
| class IconView: UIView { | |
| @IBInspectable | |
| var topColor: UIColor = .clear { | |
| didSet { | |
| updateViews() | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ListIconController: UIViewController { | |
| fileprivate func setupIconView() { | |
| //.. | |
| NotificationCenter.default.addObserver(self, selector: #selector(handleChangeColor), name: NSNotification.Name(rawValue: "colorRefersh"), object: nil) | |
| NotificationCenter.default.addObserver(self, selector: #selector(handleChangeIcon), name: Notification.Name(rawValue: "iconRefresh"), object: nil) | |
| NotificationCenter.default.addObserver(self, selector: #selector(handleChangeImage), name: Notification.Name(rawValue: "iconImage"), object: nil) | |
| } | |
| @IBAction func handleDone(_ sender: Any) { | |
| let renderer = UIGraphicsImageRenderer(size: iconView.bounds.size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class IconChooseColorCell: UICollectionViewCell { | |
| let view: UIImageView = { | |
| let cv = UIImageView() | |
| cv.translatesAutoresizingMaskIntoConstraints = false | |
| return cv | |
| }() | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| setupView() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class IconGlyphController: UIViewController { | |
| let collectionView: UICollectionView = { | |
| // Construct a collectionView | |
| }() | |
| let cellId = "ColorCell" | |
| let iconsNames = [] //Icon Names | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| setupCollectionView() |