- Pure Swift 3.
- Beautiful Colorful Picker.
import irisView
let colorPicker = irisView(frame: CGRect(x: 0, y: 0, width: pickerWidth, height: pickerHeight))
colorPicker.colors = [UIColor.red, UIColor.blue, ...]
colorPicker.center = CGPoint(x: view.frame.width/2, y: view.frame.height/2)
colorPicker.radius = pickerWidth/2
colorPicker.isShadowed = true
view.addSubview(colorPicker)
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
colorPicker.detect(touches, with: event)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
colorPicker.detect(touches, with: event)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
colorPicker.detect(touches, with: event, end: true)
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
To get the selected picker, add this code.
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
colorPicker.detect(touches, with: event)
do {
let obj = try colorPicker.detected()
print("i: \(obj.0), layer: \(obj.1)")
} catch {}
}
irisView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'irisView'
ozwio, ozwio.me@gmail.com
irisView is available under the MIT license. See the LICENSE file for more info.