Swiftpack.co - timdubbins/Sliders as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by timdubbins.
timdubbins/Sliders 1.0.2
A collection of sliders for SwiftUI. Includes range and round sliders.
⭐️ 0
🕓 2 weeks ago
iOS macOS
.package(url: "https://github.com/timdubbins/Sliders.git", from: "1.0.2")

Sliders

Current version: 1.0.2 [Download]

A collection of custom sliders for SwiftUI.

  • RoundSlider gives you a slider that acts as a dial or knob.
  • RangeSlider lets you select a range using a slider with two thumbs.

me

Getting Started

To use Sliders in a project, add this descriptor to the dependencies list in your Package.swift file:

.package(url: "https://github.com/timdubbins/sliders", .exact("1.0.2")) 

Alternatively, in Xcode, go to:

File > Add Packages...

and enter

https://github.com/timdubbins/sliders

as the package URL.

Examples

RoundSlider

@State private var myValue = 30.0
@State private var isEditing = false

var body: some View {
    RoundSlider(
        "title",
        value: $myValue,
        in: 10...70,
        displayBounds: 0...10,
        color: .green) {
            isEditing = $0
        }
}

RangeSlider

@State private var lowValue = 0.0
@State private var highValue = 10.0
@State private var onEditing = false

var body: some View {
    VStack {
        RangeSlider(
            lowValue: $lowValue,
            highValue: $highValue,
            in: 0...10
            showDifferenceOnEditing: true) {
                onEditing = $0
            }
        Text(String(onEditing))
            .foregroundColor(onEditing ? .red : .green)
    }
}

Happy coding!

GitHub

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

Release Notes

Sliders 1.0.2
2 weeks ago

The sliders now use generic binary floating point types. This means you can use them with any floating point data (Float, Double, CGFloat, etc).

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