Swiftpack.co -  sarrajbs/SlottedSlider as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
sarrajbs/SlottedSlider
Slotted slider swift package library for SwiftUI View
.package(url: "https://github.com/sarrajbs/SlottedSlider.git", from: "1.0.4")

SlottedSlider

If for some reason you need a swiftUI slider that looks like Andoid slider then this custom component may be useful to you.

Screenshot

Installation

  1. Using Xcode go to File > Swift Packages > Add Package Dependency
  2. Paste the Modele URL: https://github.com/sarrajbs/SlottedSlider.git
  3. Click on next and select the project target

If you have doubts, please, check the following link: https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app

After successfully retrieved the package and added it to your project, just import SlottedSlider and you can get the full benefits of it.

How to use

 
 import SlottedSlider
 
 let minRange: Double = 0
 let maxRange: Double = 300
 
 @State var sliderValue: Double = 0
 
 @State var displayedValue: Double = 0
 
 var body: some View {
    SlottedSlider(value: $sliderValue,
                  in: minRange...maxRange,
                  slotNumber: 7) { _ in
                    self.displayedValue = self.sliderValue
                }
 }

P.S:

  1. Parameter in: is to specify your wanted range
  2. Parameter slotNumber : is the number of displayed steps + 2 (min and max steps)

GitHub

link
Stars: 0
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

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