Swiftpack.co - terlan98/CircularSlider as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by terlan98.
terlan98/CircularSlider 1.1.0
A SwiftUI view that can be interacted with by dragging a knob over a circular path to select a value
⭐️ 14
🕓 1 week ago
iOS
.package(url: "https://github.com/terlan98/CircularSlider.git", from: "1.1.0")

CircularSlider

spm spm

A view that can be interacted with by dragging a knob over a circular path to select a value

Features

  • ☑ 🌈 Customizable colors
  • ☑ 📐 Customizable size
  • ☑ 🔠 Customizable font
  • ☑ 🏷 Customizable text with prefix and suffix

🛠 How do I install it?

You can install CircularSlider by going to your Project settings > Swift Packages and add the repository by providing the GitHub URL. Alternatively, you can go to File > Swift Packages > Add Package Dependencies...

🚀 How do I use it?

Simple Example

struct ContentView: View {
    @State var value = 50.0

    var body: some View {
        VStack {
            CircularSlider(currentValue: $value)
        }
    }
}

Fancy Example

struct ContentView: View {
    @State var value = 25.0

    var body: some View {
        VStack {
            CircularSlider(currentValue: $value,
                           minValue: 1,
                           maxValue: 30,
                           knobColor: .orange,
                           progressLineColor: .orange,
                           font: .custom("HelveticaNeue-Light", size: 35),
                           backgroundColor: .gray.opacity(0.05),
                           currentValueSuffix: "$")
        }
    }
}

Even Fancier Example...

struct ContentView: View {
    @State var value = 50.0

    var body: some View {
        VStack {
            CircularSlider(currentValue: $value,
                           minValue: 1,
                           maxValue: 60,
                           knobColor: .init(red: 0.5, green: 0.5, blue: 0.5),
                           progressLineColor: .init(red: 0.84, green: 0.93, blue: 0.09),
                           font: .custom("HelveticaNeue-Light", size: 35),
                           backgroundColor: .yellow.opacity(0.09),
                           currentValueSuffix: " min")
        }
    }
}

License

CircularSlider is released under the MIT license. See LICENSE for details.

Buy Me A Coffee

GitHub

link
Stars: 14
Last commit: 1 week ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.1.0
1 week ago
  • Add a callback that is called when the user releases the knob

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