- iOS 10.3+ target (you can adjust project to use older)
- tvOS Support (tvOS 10.2 and later)
- 100% Swift 4.0 code (almost no code changes for swift 3.1 if you need)
- Simple adoption
- Very lightweight (1 storyboard, no images)
- Bitcode enabled
Note: Only the color chips are delivered by the framework, the button and the larger green chip are part of the example application.
##Simple use:
-
Download code
-
Compile Framework
Can use Carthage here for iOS: github "HasanEdain/NPCColorPicker"
-
Add Framework to your project
-
Add a UIView that will contain the colors (don't forget to constrain the view)
-
Adopt the NPCColorPickerViewDelegate protocol
class ViewController: UIViewController, NPCColorPickerViewDelegate
- Make and initialize an NPCColorPicker variable in your viewController:
var colorPicker = NPCColorPicker()
- Place the pickerView in your view:
self.colorPicker.embedColorPickerInView(self.embedView, forDelegate: self)
- Customize as desired
You can use your own set of colors (Alpha and hash tag #ffffffff is also supported) self.colorPicker.changeColorSet(["ffffff","ff0000","00ff00","0000ff","000000"]) You can set the colors to a gradient of your choosing self.colorPicker.changeColorToGradient("ff0000", endColor: "0000ff", steps: 32) You van set an array of gradients: self.colorPicker.changeColorToGradientArray(["ffffff","000000","ff0000","00ff00","0000ff"], steps: 16) You can set the size of the touch targets for the colors self.colorPicker.changeDiameter(32.0) You can change the shape of the touch targets for the colors self.colorPicker.changeMaskStyle(.roundedRect) .square, and .circle are provided as well You can change the space between rows and columns of colors. self.colorPicker.changeSpaceBetweenColors(8.0, columns: 8.0)
- Implement the single delegate method:
func colorChosen(color: UIColor) { self.colorView.backgroundColor = color }
What you do with it is up to you.
NPC Unlimited http://npcunlimited.com
Bush Software http://www.bushsoftware.com
- Fix Carthage for tvOS
- A method to provide a mask and or a frame for chips
- Improve / Test install and configure
- Add unit tests.
- Add UI Tests
- Add Performance test
Please send feedback to [email protected]