Swiftpack.co - tokiensis/WheelPicker as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by tokiensis.
tokiensis/WheelPicker 1.2.1
Pure-SwiftUI WheelPicker providing a circular, finite, or infinite selection.
⭐️ 15
🕓 39 weeks ago
iOS macOS
.package(url: "https://github.com/tokiensis/WheelPicker.git", from: "1.2.1")

WheelPicker

Build status Platform iOS Platform macOS Swift 5 compatible Carthage compatible CocoaPods compatible License: MIT

Introduction

WheelPicker is ...

  • Pure-SwiftUI picker like iOS standard wheel style picker
    • No UIKit views are used internally, so it works smoothly with animated SwiftUI views.
    • You can also add it to macOS projects.
  • Various selection styles are available
    • Circular style
    • Finite style
    • Infinite style (ex. used to select a date)
  • Custumizable item label
    • Formatting display text as you like
    • Changing text color, font, or size
    • Complex labels with Image, Shape, etc...

Usage

import WheelPicker

struct ContentView: View {
    @State private var circularWheelPickerSelection: Int = 0
    @State private var finiteWheelPickerSelection: Int = 0
    @State private var dateWheelPickerSelection: Date = Date()
    let items: [Int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    
    var body: some View {
        VStack {
            // Circular style picker
            CircularWheelPicker(selection: $circularWheelPickerSelection, items: items) { value in
                // value may be nil (If the label is out of range)
                if let value = value {
                    Text("\(value)")
                } else {
                    Text("")
                }
            }
            // Finite style picker
            FiniteWheelPicker(selection: $finiteWheelPickerSelection, items: items) { value in
                // value may be nil (If the label is out of range)
                if let value = value {
                    Text("\(value)")
                } else {
                    Text("")
                }
            }
            // Date select picker (Multiple columns)
            DateWheelPicker(selection: $dateWheelPickerSelection) { date in
                let components = Calendar.current.dateComponents([.weekday], from: date)
                switch components.weekday {
                case 1: return .red // Sunday
                case 7: return .blue // Saturday
                default: return nil
                }
            }
        }
    }
}

Requirements

  • iOS 14.0+
  • macOS 11.0+
  • Xcode 12.0+

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you found a bug or need help please check older issues, FAQ and threads on StackOverflow (Tag 'WheelPicker') before submitting an issue.

Before contribute check the CONTRIBUTING file for more info.

Examples

Follow these 3 steps to run Example project: clone WheelPicker repository, open WheelPicker workspace and run the Example project.

Installation

SwiftPM

https://github.com/tokiensis/WheelPicker.git

CocoaPods

pod 'WheelPicker-SwiftUI', '~> 1.0.0'

Carthage

github "tokiensis/WheelPicker" ~> 1.0.0

Author

FAQ

How to .....

You can do it by conforming to .....

Changelog

See CHANGELOG.

GitHub

link
Stars: 15
Last commit: 39 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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