Swiftpack.co - Package - ysmaliak/ColorPicker

ColorPicker

swift-version swift-package-manager platform
Color Picker for iOS written in Swift

Color Picker Screenshot

Usage

let colorPicker: ColorPicker = ColorPicker(action: #selector(setColor))
colorsContainer.addSubview(colorPicker)
colorPicker.setConstraints(view: colorsContainer)

@objc private func setColor(sender: UIButton) {
    colorPicker.newHostForRing(host: sender)
    sequenceName.textColor = sender.backgroundColor
    chosenColor = sender.backgroundColor!
}

You can use NSLayoutConstraint.activate([...]) instead of colorPicker.setConstraints(view: ...) to set your own constraints.

You can also initialize it with your colors and/or number of colors in a row:

let colorPicker: ColorPicker = ColorPicker(action: #selector(setColor), colors: [.black, .white])

let colorPicker: ColorPicker = ColorPicker(action: #selector(setColor), perRow: 3)

let colorPicker: ColorPicker = ColorPicker(action: #selector(setColor), colors: [.black, .white], perRow: 1)

Installation

Using Swift Package Manager of manually adding files from the Sources folder to your project.

Github

link
Stars: 3

Dependencies

Used By

Total: 0