Skip to content

Latest commit

 

History

History
70 lines (47 loc) · 1.68 KB

README.md

File metadata and controls

70 lines (47 loc) · 1.68 KB

ColorPicker

ColorPicker is a UI component for pick a color.

Requirements

  • Swift 6

  • iOS 15

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)
    }
}

Apps using ColorPicker

Maintainer

@noppefoxwolf

License

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

Prohibited matter 🚫

Forking or contributing in order to disguise the activity of spam accounts as legitimate accounts is prohibited.