Created
May 3, 2018 22:53
-
-
Save aronbalog/445896de134ccf67c4031e448308eecc to your computer and use it in GitHub Desktop.
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
import UIKit | |
import CoreNavigation | |
import ChromaColorPicker | |
class ColorViewController: UIViewController { | |
lazy var colorPicker: ChromaColorPicker = { | |
let view = ChromaColorPicker(frame: CGRect(x: 0, y: 0, width: 300, height: 300)) | |
view.padding = 5 | |
view.stroke = 3 | |
view.hexLabel.textColor = UIColor.black | |
view.delegate = self | |
return view | |
}() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.addSubview(colorPicker) | |
colorPicker.center = view.center | |
} | |
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
colorPicker.adjustToColor(view.backgroundColor ?? .black) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment