CircleSlider is a Circular slider library. written in pure Swift.

Related tags

Slider CircleSlider
Overview

CircleSlider

CI Status Version License Platform

Description and appetize.io`s DEMO

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 8.0+
  • Xcode 8.0

Installation

CocoaPods(iOS 8+)

CircleSlider is available through CocoaPods. To install it, simply add the following line to your Podfile:

use_frameworks!
pod "CircleSlider"

Manual Installation

The class file required for CircleSlider is located in the Classes folder in the root of this repository as listed below:

CircleSlider.swift
TrackLayer.swift
Math.swift

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Simple

self.circleSlider = CircleSlider(frame: self.sliderArea.bounds, options: nil)
self.circleSlider?.addTarget(self, action: Selector("valueChange:"), forControlEvents: .ValueChanged)
self.sliderArea.addSubview(self.circleSlider)

Custom

let options = [
.BarColor(UIColor(red: 198/255, green: 244/255, blue: 23/255, alpha: 0.2)),
.ThumbColor(UIColor(red: 141/255, green: 185/255, blue: 204/255, alpha: 1)),
.TrackingColor(UIColor(red: 78/255, green: 136/255, blue: 185/255, alpha: 1)),
.BarWidth(20),
.StartAngle(-45),
.MaxValue(150),
.MinValue(20)
]
self.circleSlider = CircleSlider(frame: self.sliderArea.bounds, options: options)
self.circleSlider?.addTarget(self, action: Selector("valueChange:"), forControlEvents: .ValueChanged)
self.sliderArea.addSubview(self.circleSlider)

Change options after instantiation

self.circleSlider.changeOptions([.BarWidth(45)])

Customization

  • case StartAngle(Double)
  • case BarColor(UIColor)
  • case TrackingColor(UIColor)
  • case ThumbColor(UIColor)
  • case ThumbImage(UIImage)
  • case BarWidth(CGFloat)
  • case ThumbWidth(CGFloat)
  • case MaxValue(Float)
  • case MinValue(Float)
  • case SliderEnabled(Bool)
    • If you want to use as a progress, it should be this to false
  • case ViewInset(CGFloat)
  • case MinMaxSwitchTreshold(Float)

Author

shushutochako, [email protected]

License

CircleSlider is available under the MIT license. See the LICENSE file for more info.

Comments
  • fatal error: found nil while unwrapping an Optional value

    fatal error: found nil while unwrapping an Optional value

    I was using the circle slider for my app, when this happened:

    private func redraw() {
        self.trackLayer.removeFromSuperlayer()
        self.trackLayer = TrackLayer(bounds: self.bounds, setting: self.createLayerSetting())
        self.thumbView.removeFromSuperview()
        self.thumbView = UIView(frame: CGRect(x: 0, y: 0, width: self.thumbWidth, height: self.thumbWidth))
        self.layout(self.latestDegree)
      }
    

    It called a EXC Bad Instruction on the .removeFromSuperlayer(). This is part of the framework.

    When I run on a physical device, I get EXC_BREAKPOINT and my view won't load.

    The cause may have been when I used

    circleSlider.addTarget(self, action: #selector(TodayViewController.chngVol(_:)), forControlEvents: .ValueChanged)
    

    without specifying it as an Optional, as Xcode wouldn't let me make it an Optional.

    How should I fix this?!

    opened by carson-katri 0
  • How do I get the current value of CircleSlider?

    How do I get the current value of CircleSlider?

    Usually I use sender.value to get the current value but I can't do that with this library. Only UILabel can get the current value such as the example down there? But I want to use it as float and send it to another function, what can I do?

    func valueChange(sender: CircleSlider) { switch sender.tag { case 0: self.valueLabel.text = "(Int(sender.value))" case 1: self.progressLabel.text = "(Int(sender.value))%" default: break } }

    opened by simon753 0
  • Fix: latestDegree isn't saved when value is set

    Fix: latestDegree isn't saved when value is set

    When the value property is set programatically and then the component re-renders, the slider position resets to a previous state and the UI no longer matches the value property.

    The fix is to update latestDegree when the value is set explicitly.

    opened by allanca 0
  • Problems with Example Project

    Problems with Example Project

    Hi, I wanted to try your pod, but I had following problems. I managed to overcome them (leave my solutions for reference), but it think it could be fixed for other users:

    1. pod try CircleSlider doesn't work - I had to clone repository
    2. pod install (in Example directory) doesn't work - I changed Podfile and removed exclusive part (after name and before 'do')
    3. example didn't start due to provisioning profile problems - I changed profile to mine.
    4. example didn't build due to provisioning problems in test project - (again changed profile)

    (I don't know if 3 and 4 are fixable, but let's hope so :) )

    Also pod install throws some warnings and on IPhone 5C sliders overleap with progress circle (but it doesn't make it unreadable).

    Thank you for this pod. I think it will really help me.

    opened by franiis 0
  • few CircleSlider ?

    few CircleSlider ?

    hello I am used few to slider

     @IBOutlet weak var FoodQSlider      : UIView!
        @IBOutlet weak var Cleanness        : UIView!
        @IBOutlet weak var StaffPerformance : UIView!
        @IBOutlet weak var Facilities       : UIView!
        @IBOutlet weak var InternetService  : UIView!
        @IBOutlet weak var AccToBazzar      : UIView!
        @IBOutlet weak var AccToEntertain   : UIView!
    

    and The initialization all have

    let delay = 0.1 * Double(NSEC_PER_SEC) let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay)) dispatch_after(time, dispatch_get_main_queue(), { self.circleSlider.value = Float(self.reviwesRoundTwo[0]) }) but only last slide shows the correct 12

    complete source

     private func buildCircleSliderFoodQSlider() {
            self.circleSlider = CircleSlider(frame: self.FoodQSlider.bounds, options: self.sliderOptions)
    
            let delay = 0.1 * Double(NSEC_PER_SEC)
            let time  = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
            dispatch_after(time, dispatch_get_main_queue(), {
                self.circleSlider.value = Float(self.reviwesRoundTwo[0])
            })
            self.FoodQSlider.addSubview(self.circleSlider!)
            self.valueLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
            self.valueLabel.textAlignment = .Center
            self.valueLabel.center = CGPoint(x: CGRectGetWidth(self.circleSlider.bounds) * 0.5, y: CGRectGetHeight(self.circleSlider.bounds) * 0.5)
            self.valueLabel.text = String(reviwesRoundTwo[0])
            self.circleSlider.addSubview(self.valueLabel)
        }
    
    
    opened by J-Arji 2
  • how can look Circleslider ?

    how can look Circleslider ?

    hello how can look FoodQSlider ?

       @IBOutlet weak var FoodQSlider      : UIView!
    
    private func buildCircleSliderFoodQSlider() {
            self.circleSlider = CircleSlider(frame: self.FoodQSlider.bounds, options: self.sliderOptions)
    
            let delay = 0.1 * Double(NSEC_PER_SEC)
            let time  = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
            dispatch_after(time, dispatch_get_main_queue(), {
                self.circleSlider.value = Float(self.reviwesRoundTwo[0])
            })
            self.FoodQSlider.addSubview(self.circleSlider!)
            self.valueLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
            self.valueLabel.textAlignment = .Center
            self.valueLabel.center = CGPoint(x: CGRectGetWidth(self.circleSlider.bounds) * 0.5, y: CGRectGetHeight(self.circleSlider.bounds) * 0.5)
            self.valueLabel.text = String(reviwesRoundTwo[0])
            self.circleSlider.addSubview(self.valueLabel)
        }
    
    
    opened by J-Arji 2
Releases(0.6.0)
Owner
Nobuyasu
Nobuyasu
A powerful Circular Slider. It's written in Swift, it's 100% IBDesignable and all parameters are IBInspectable.

CircularSlider A powerful Circular Slider. It's written in Swift, it's 100% IBDesignable and all parameters are IBInspectable. Demo Installation Circu

Matteo Tagliafico 253 Sep 19, 2022
IntervalSlider is a slider library like ReutersTV app. written in pure swift.

IntervalSlider Description and appetize.io`s DEMO To run the example project, clone the repo, and run pod install from the Example directory first. Re

Nobuyasu 65 May 23, 2021
A custom reusable circular / progress slider control for iOS application.

HGCircularSlider Example To run the example project, clone the repo, and run pod install from the Example directory first. You also may like HGPlaceho

Hamza Ghazouani 2.4k Jan 4, 2023
PhotoSlider is a simple photo slider and can delete slider with swiping.

PhotoSlider is a simple photo slider and can delete slider with swiping.

Daichi Nakajima 247 Nov 30, 2022
A custom reusable slider control with 2 thumbs (range slider).

MARKRangeSlider A custom reusable slider control with 2 thumbs (range slider). Values range is between minimumValue and maximumValue (from 0 to 1 by d

Vadym Markov 181 Nov 21, 2022
An iOS Slider written in Swift.

JDSlider Beetripper App's screenshots Example Project To run the example project, clone the repo, and run pod install from the Example directory first

Jelly Development 84 Jul 26, 2022
VerticalSlider - An animatable and customizable vertical slider written in Swift 4

VerticalSlider An animatable and customizable vertical slider written in Swift 4. Quick Start VerticalSliderPlayground Clone Repo Open VSVerticalSlide

Vincent Smithers 13 Apr 26, 2022
💧 A slider widget with a popup bubble displaying the precise value selected. Swift UI library made by @Ramotion

FLUID SLIDER A slider widget with a popup bubble displaying the precise value selected written on Swift. We specialize in the designing and coding of

Ramotion 1.9k Dec 23, 2022
A simple range slider made in Swift

RangeSlider Summary A simple range slider made in Swift. Screenshot Use This control is IBDesignable and uses the target-action pattern for change not

William Archimede 305 Nov 29, 2022
A beautiful slider control for iOS built purely upon Swift

SnappingSlider A beautiful slider control for iOS. Installation There are two ways to add the control to your project; you can add it as a submodule i

Rehat Kathuria 577 Dec 15, 2022
VerticalSlider is a vertical slider control for iOS in Swift.

?? VerticalSlider If you like VerticalSlider, give it a ★ at the top right of this page. Overview VerticalSlider is a vertical implementation of the U

Jon Kent 78 Sep 15, 2022
FlowerSlider - Flower Slider Animation Built With Swift

FlowerSlider Shape Slider Screenshot

Joey Graham 4 Sep 27, 2022
🎚️ STDiscreteSlider – slider which allows user to choose value only from predefined set of data.

STDiscreteSlider – slider which allows user to choose value only from predefined set of data. Slider may receive any types of options, you may pass set of integers or strings, or any other type. Written using SwiftUI.

Tamerlan Satualdypov 15 Apr 3, 2022
A reusable Slider View made with SwiftUI

ZSlider A reusable Slider View made with SwiftUI. Installation: Minimum version iOS 13 In Xcode go to File -> Swift Packages -> Add Package Dependency

null 7 Dec 15, 2022
Custom & highly configurable seek slider with sliding intervals, disabled state and every possible setting to tackle!

iLabeledSeekSlider Custom & highly configurable seek slider with sliding intervals, disabled state and every possible setting to tackle! Minimum iOS v

Edgar Žigis 9 Aug 16, 2022
TriggerSlider is a simple SwiftUI trigger slider

TriggerSlider is a simple SwiftUI trigger slider which can be used instead of a button, e.g. in a situation where the

Dominik Butz 4 Dec 16, 2022
This is an iOS Tweak that modifies the brightness slider in the Control Center.

AdvancedBrightnessSlider Tweak This is an iOS Tweak that modifies the brightness slider in the Control Center. Even with dark mode toggled on, I found

Jonas Schiefner 18 Jan 5, 2023
Use UIResponder to imitate an iOS slider.

WWSlider Use UIResponder to imitate an iOS slider. 使用UIResponder仿造一個iOS的滑桿. Installation with Swift Package Manager dependencies: [ .package(url:

William-Weng 2 May 5, 2022
VolumeControl is a custom volume control for iPhone featuring a well-designed round slider.

#VolumeControl VolumeControl is a custom volume control for iPhone featuring a well-designed round slider. Preview Usage // Include VolumeControl.h in

12Rockets 81 Oct 11, 2022