GithubHelp home page GithubHelp logo

oberto / ios-tactile-slider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daprice/ios-tactile-slider

0.0 1.0 0.0 4.38 MB

UIControl slider that can be dragged from any point within its bounds, similar to those in Control Center and Home.app

License: MIT License

Ruby 6.80% Swift 93.20%

ios-tactile-slider's Introduction

TactileSlider

CI Status Version License Platform

A slider control designed to be easy to grab and use because it can be dragged or tapped from anywhere along its track, similar to the sliders in Control Center and HomeKit.

Animation of TactileSliders in various orientations being clicked and dragged in the iOS simulator, followed by a transition from light to dark appearance

Features

  • Can be dragged or (optionally) tapped to set a value
  • Supports horizontal and vertical orientation in either direction
  • IBDesignable โ€“ colors, values, rounded corners, and behavior can be customized in Interface Builder or programatically
  • Supports light & dark appearance using semantic system colors by default (iOS 13+)
  • Adjustable haptic feedback (iOS 10+)
  • VoiceOver support
  • Supports pointer (e.g. trackpad or mouse) based scrolling on iPadOS (iOS 13.4+)

Example

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

Requirements

iOS 8.0+

  • iOS 10.0+ required for haptic feedback
  • iPadOS 13.4+ required for pointer use

Installation

TactileSlider is available as a Swift package or through CocoaPods.

To install it using CocoaPods, simply add the following line to your Podfile:

pod 'TactileSlider'

Usage

let slider = TactileSlider(frame: someRect)

slider.minimumValue = 1
slider.maximumValue = 10

slider.setValue(3.8, animated: true)

Setting orientation and direction

slider.vertical = true
slider.reverseValueAxis = true

Adjusting behavior

slider.isContinuous = false
slider.enableTapping = false // allow or disallow tapping anywhere on the slider track to instantly set a value
slider.feedbackStyle = .medium // customize haptic feedback
slider.isScrollingEnabled = false // allow or disallow scrolling to adjust the slider using a connected pointing device on iPadOS

Changing colors and appearance

slider.trackBackground = UIColor.black.withAlpha(0.8) // use translucent black for the slider track
slider.tintColor = UIColor.systemGreen // use dynamic green for the slider thumb
slider.cornerRadius = 12
slider.isPointerInteractionEnabled = true // display a hover effect when under the pointer on iPadOS

Interface Builder

screenshot of Xcode Interface Builder demonstrating a TactileSlider being customized using the graphical interface

Author

Dale Price (@[email protected])

License

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

ios-tactile-slider's People

Contributors

daprice avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.