Swiftpack.co - komaji/LabelPicker as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by komaji.
komaji/LabelPicker v1.4.0
LabelPicker is available to add labels for components to UIPickerView.
⭐️ 7
🕓 1 week ago
iOS
.package(url: "https://github.com/komaji/LabelPicker.git", from: "v1.4.0")

LabelPicker

Build Status Language Platform Carthage compatible Swift Package Manager License

LabelPicker is available to add labels for components to UIPickerView. Frame of components and labels is calicurated automaticaly from your specified values of items and labels width.

https://gyazo.com/41ae851edca077bd87f2cea8422781ba

Usage

let hours = (0...23).map { "\($0)" }
let min = (0...59).map { "\($0)" }
let sec = (0...59).map { "\($0)" }
let attributes: [NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: 16.0)]

let itemsComponents = [hours, min, sec]
    .map { ItemsComponent(items: $0, attributes: attributes, maxWidth: 20.0) }
let labelComponents = [("hours", 50.0), ("min", 30.0), ("sec", 30.0)]
    .map { LabelComponent(name: $0, attributes: attributes, width: $1) }
let components = zip(itemsComponents, labelComponents).map(LabelPickerComponent.init)

let pickerView = LabelPickerView()
pickerView.rowHeight = 30.0
pickerView.components = components

view.addSubview(pickerView)

See Demo for more info.

Requirements

  • iOS 10.0
  • Xcode 9.0
  • Swift 4.0

Installation

Swift Package Manager

Specify LabelPicker as a dependency of your Package.swift.

dependencies: [
    .package(url: "https://github.com/komaji/LabelPicker.git", .upToNextMajor(from: "VERSION_NUMBER")),
],

Carthage

Add this to your Cartfile:

github "komaji/LabelPicker"

Then, run the following command:

$ carthage update

Lisence

MIT

GitHub

link
Stars: 7
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

1.5.0
1 week ago

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