TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by Rapple UI Animator.
To run the example project, clone the repo, and run pod install
from the Example directory first.
RappleColorPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "RappleColorPicker"
First import color picker pod in your Swift class
import RappleColorPicker
Parameters required to open color pallet
onViewController
viewController to open color palet - this parameter cannot be nilorigin
origin point of the color pallet - Default : CGPoint.zerodelegate
RappleColorPickerDelegatetitle
color pallet name, send nil to hide the title bartag
identification tagattributes
look and feel attribute dictionary (Title, BGColor, TintColor, Style, BorderColor)attribute
dictionary should have these key values located in RappleCPAttributeKey
enum. If any of the key cannot be located in attributes default values will use to create UIs
enum RappleCPAttributeKey {
case Title `Title text - attributes without Title will hide title bar from UI`
case BGColor `Background color`
case Style `Cell style (Square, Circle)`
case TintColor `TintColor Tint Color (Text color, cell border color)`
case BorderColor `Color pallet border Color (Complete pallet border)`
}
Style
key must have one of the these styles
RappleCPStyleSquare
// Squre shaped color picker cellsRappleCPStyleCircle
// Circular shaped color picker cellsDefault picker size - 230x358 (without title) or 230x384 (with title)
RappleColorPicker.openColorPallet(onViewController: self, origin: origin, delegate: self, title: "title")
RappleColorPicker.openColorPallet(onViewController: self, origin: origin, delegate: self, title: "title", tag: 1)
RappleColorPicker.openColorPallet(onViewController: self, origin: origin, delegate: self, attributes: attributes)
RappleColorPicker.openColorPallet(onViewController: self, origin: origin, delegate: self, attributes: attributes, tag: 1)
To receive selected color implement a one of the ‘RappleColorPickerDelegate’ delegate.
func colorSelected(color: UIColor) {
RappleColorPicker.close()
}
or
func colorSelected(color:UIColor, tag: Int) {
switch (tag) {
case 1: `set tag one color`
case 2: `set tag two color`
default: ()
}
RappleColorPicker.close()
}
If both are implemented priority will be given to func colorSelected(color:UIColor, tag: Int)
method and func colorSelected(color: UIColor)
method will not be called
RappleColorPicker.close()
To run the example project, clone the repo, and run pod install
from the Example directory first.
Rajeev Prasad, [email protected]
Copyright © 2016 Rajeev Prasad [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.