ColorPicker

0.5.1

A opensource color picker UI component for iOS
noppefoxwolf/ColorPicker

What's New

0.5.1

2022-07-17T16:00:19Z

Full Changelog: 0.5.0...0.5.1

ColorPicker

ColorPicker is a UI component for pick a color.

Requirements

  • Swift5.6

  • iOS15

Installation

Adding Package Dependencies to Your App

Getting Started

Present ColorPicker

import ColorPicker
...
let vc = ColorPickerViewController()
vc.setDelegate(self)
present(vc, animated: true)

Customize swatch colors

let vc = ColorPickerViewController()
var configuration = ColorPickerConfiguration.default
configuration.initialColor = .red
configuration.initialColorItems = [.init(id: UUID(), color: .red)]
vc.configuration = configuration
vc.setDelegate(self)
present(vc, animated: true)

Handle changed color

extension ContentViewController: ColorPickerViewControllerDelegate {
    func colorPickerViewControllerDidFinish(_ viewController: ColorPickerViewController) {
        print(#function, viewController.selectedColor)
    }
    
    func colorPickerViewController(_ viewController: ColorPickerViewController, didSelect color: UIColor, continuously: Bool) {
        print(#function, color, continuously)
    }
}

Maintainer

@noppefoxwolf

License

ColorPicker is available under the MIT license. See the LICENSE file for more info.

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Fri Apr 12 2024 09:29:00 GMT-0900 (Hawaii-Aleutian Daylight Time)