Swiftpack.co - henzai-apps/ColorPicker as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by henzai-apps.
henzai-apps/ColorPicker 0.1.2
A opensource color picker UI component for iOS
⭐️ 11
🕓 2 weeks ago
iOS
.package(url: "https://github.com/henzai-apps/ColorPicker.git", from: "0.1.2")

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.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics