SMNumberWheel is a subclass of UIControl written in Swift, which is ideal for picking numbers using a rotating wheel.

Overview

SMNumberWheel

version: 1.0.3

[![CI Status](http://img.shields.io/travis/Sina Moetakef/SMNumberWheel.svg?style=flat)](https://travis-ci.org/Sina Moetakef/SMNumberWheel) Carthage compatible Version License Platform

Introduction

SMNumberWheel is a custom made control (subclass of UIControl) for iOS, written in Swift, which is ideal for picking numbers instead of typing them by software keyboards. The main idea is to be able to pick numbers very fast and and yet accurate. The wheel works with reading the angular speed of user's finger. The slower you spin the wheel, the more accurate values are changed (up to 4 fraction digits accurate). The more rotation speed results in exponentially faster value changes.

![alt tag] (https://github.com/SinaMoetakef/SMNumberWheel/blob/master/Example/SMNumberWheel/SMNumberWheel.png)

Features

  • Highly customizable through properties which results in thousands of different designs.
  • Renders in InterfaceBuilder, has customizable properties visible with Attributes Inspector (InterfaceBuilder).
  • Supports sounds and haptic feedbacks (iPhone 7 and iPhone 7+)
  • Built-in buttons: Stepper buttons and central reset button.
  • supports iOS 9.0 and above

Installation

CocoaPods

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

pod "SMNumberWheel"

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate SMNumberWheel into your Xcode project using Carthage, specify it in your Cartfile:

github "SinaMoetakef/SMNumberWheel"

Run carthage update to build the framework and drag the built SMNumberWheel.framework into your Xcode project.

  • don't forget the run-script!

Video links

Usage

Adding from code

Sample code:

let wheel = SMNumberWheel(frame: CGRect(x: 100, y: 100, width: 180, height: 180))
wheel.majorIndicators = 4
wheel.majorIndicatorType = .diamond
wheel.minorIndicatorType = .none
wheel.ringColor = UIColor.red
wheel.strokeColor = UIColor.red
wheel.stepper = false
wheel.hapticFeedback = true
// continue setting up the properties ...
wheel.delegate = self
self.view.addSubview(wheel)

Adding from InterfaceBuilder

After installing the pod:

  • Add a view to the ViewController's view hierarchy using InterfaceBuilder
  • Setup constranits of the view
  • Set the view's class to be SMNumberWheel
  • set the ModuleName to be SMNumberWheel
  • Wait for the InterfaceBuilder to render the wheel

Customizing the Wheel using InterfaceBuilder

  • Have the view selected.
  • Open Attributes Inspector section
  • Change properties available for the wheel like sizes, colors, styles, ...
  • The changes will be rendered in InterfaceBuilder.

Connecting to code and receive events

Like all other widgets, you can easily drag an outlet from the viewController to your code. In order to connect events, you can use either of the following methods:

  • Drag a target action from the viewController to your code and choose Value Changed as event type
  • implement the delegate methods to get more events.
extension viewController : SMNumberWheelDelegate {
    func SMNumberWheelDidResetToDefaultValue(_ numberWheel: SMNumberWheel) {
        // Happens when the central button is tapped and the wheel is set to it's initial value
    }
    func SMNumberWheelValueChanged(_ numberWheel: SMNumberWheel) {
        // Happens when the value of the wheel changes.
    }
    func SMNumberWheelReachedLimit(_ numberWheel: SMNumberWheel, stayedAtLimit: Bool) {
        // Notifies the developer that the value of the wheel has reached one of the limits.
    }
    func SMNumberWheelStepperKeyPressed(_ numberWheel: SMNumberWheel, rightKey: Bool) {
        // Notifies that a tap on one of the stepper keys is detected. 
        // rightKey == true -> tapped on right key, otherwise tapped on the left key.
    }
    func SMNumberWheelChangedAppearance(_ numberWheel: SMNumberWheel, minimized: Bool) {
        // Notifies the developer that the visual state of the wheel is changed (minimized or maximized).
    }
}

Example

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

Author

Sina Moetakef, [email protected]

License

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

You might also like...
SpriteKit 2D Breakout Game on rotating 3D SceneKit cube almost no code
SpriteKit 2D Breakout Game on rotating 3D SceneKit cube almost no code

2D Breakout game playable as texture on a rotating cube An Xcode12 project for iOS that implements a simple 2D SpriteKit "Break Out" style game. The S

NumberMorphView a view like label for displaying numbers which animate with transition using a technique called number tweening or number morphing.
NumberMorphView a view like label for displaying numbers which animate with transition using a technique called number tweening or number morphing.

NumberMorphView a view like label for displaying numbers which animate with transition using a technique called number tweening or num

The ultimate spinning wheel view that supports dynamic content and rich customization.
The ultimate spinning wheel view that supports dynamic content and rich customization.

The ultimate spinning wheel control that supports dynamic content and rich customization. Main Features ๐Ÿต Dynamic content, supports texts, images, an

Handy UIControl subclasses. (Think Three20/NimbusKit of UIControls.)

STAControls STAControls is a collection of classes that aim to make dealing with Cocoa's UIControl subclasses more convenient, and to reduce the compl

WWFortuneWheelView - A scroll wheel that can be customized.
WWFortuneWheelView - A scroll wheel that can be customized.

WWFortuneWheelView A scroll wheel that can be customized. ไธ€ๅ€‹ๅฏไปฅ่‡ช่จ‚ๆ•ธ้‡็š„ๆปพ่ผช. Installation with Swift Package Manager dependencies: [ .package(url: "http

Swift-flows - Simplistic hot and cold flow-based reactive observer pattern for Swiftโ€ฆ ideal for MVVM architectures

SwiftFlows Simplistic hot and cold flow-based reactive observer pattern for Swif

 masOS project about Ideal Gas Law for SwiftUIJam
masOS project about Ideal Gas Law for SwiftUIJam

GasLaw masOS project about Ideal Gas Law for SwiftUIJam This SwiftUI macOS app models the Ideal Gas Law in a engine cylinder. Our starting point: Atmo

This is an app for coffee drinkers who want to find out what they're ideal bedtime is.
This is an app for coffee drinkers who want to find out what they're ideal bedtime is.

BetterRest This is an app for coffee drinkers who want to find out what they're ideal bedtime is. This was a part of my SwiftUI course. In this app my

A sample app that implements the ideal UI representation around the loading process
A sample app that implements the ideal UI representation around the loading process

SwiftUILoadingStateSample This is a sample app that implements the ideal UI repr

A framework to provide logic designed to prompt users at the ideal moment for a review of your app/software

ReviewKit ReviewKit is a Swift package/framework that provides logic designed to prompt users at the ideal moment for a review of your app. At a basic

An iOS picker view to serve all your
An iOS picker view to serve all your "picking" needs

Mandoline The PickerView is a UICollectionView that provides a smooth "picking" interface. In order to get the most out of it, a consuming view contro

A nicer iOS UI component for picking date and time
A nicer iOS UI component for picking date and time

DateTimePicker A nicer iOS UI component for picking date and time. Features Date and Time Picker / Date Picker only / Time Picker only - your choice!

An iOS picker view to serve all your
An iOS picker view to serve all your "picking" needs

Mandoline The PickerView is a UICollectionView that provides a smooth "picking" interface. In order to get the most out of it, a consuming view contro

A simple, customizable Country picker for picking country or dialing code. ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡ฏ๐Ÿ‡ต ๐Ÿ‡ฐ๐Ÿ‡ท ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡จ๐Ÿ‡ณ ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ช๐Ÿ‡ธ ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡ท๐Ÿ‡บ ๐Ÿ‡ฌ๐Ÿ‡ง A SwiftUI calendar view that allows month switching and date picking.
A SwiftUI calendar view that allows month switching and date picking.

Selectable Calendar View A SwiftUI calendar view that allows month switching and date picking. Usage You can simply add this repository to your projec

FancyGradient is a UIView subclass which let's you animate gradients in your iOS app. It is purely written in Swift.
FancyGradient is a UIView subclass which let's you animate gradients in your iOS app. It is purely written in Swift.

FancyGradient is a UIView subclass which let's you animate gradients in your iOS app. It is purely written in Swift. Quickstart Static gradient let fa

iOS application to extract accession numbers from wall labels using Vision and VisionKit frameworks.
iOS application to extract accession numbers from wall labels using Vision and VisionKit frameworks.

iOS application to extract accession numbers from wall labels using Vision and VisionKit frameworks. Important This is experimenta

A fully customisable swift subclass on UIButton which allows you to create beautiful buttons without writing any line of code.
A fully customisable swift subclass on UIButton which allows you to create beautiful buttons without writing any line of code.

JSButton Demo $ pod try JSButton ...or clone this repo and build and run/test the JSButton project in Xcode to see JSButton in action. If you don't ha

UILabel subclass, which additionally allows shadow blur, inner shadow, stroke text and fill gradient.
UILabel subclass, which additionally allows shadow blur, inner shadow, stroke text and fill gradient.

THLabel THLabel is a subclass of UILabel, which additionally allows shadow blur, inner shadow, stroke text and fill gradient. Requirements iOS 4.0 or

Comments
  • Add Carthage support

    Add Carthage support

    • Add pre-built framework to repository.
    • IBDesignable will not work with Carthage!

    Please release a version (tag-version) since it is requirement for Carthage. maybe 1.0.1

    opened by farshadtx 1
  • Pod import error (plus suggested fix?)

    Pod import error (plus suggested fix?)

    "simply add the following line to your Podfile" from the documentation gives an "[!] Unable to find a specification..." on pod install. This extended version makes it work:

    pod 'SMNumberWheel', :git => 'https://github.com/SinaMoetakef/SMNumberWheel.git'

    This is probably due to my gaps in fully understanding the Cocoapods setup. But then, maybe I am not the only one who would benefit from updating the remark...

    Thanks!

    opened by jmbremer 0
Releases(1.0.2)
Owner
null
Stepper-View - Stepper view using with UICollectionView with Custom animation & Transation

Stepper view using with UICollectionView with Custom animation & Transation. ??

mohamed gamal 3 Jun 28, 2022
Numbers animation allows you to click on different numbers and accordingly it will animate numbers in a cool way. It has a very attractive UI and is very easy to use.

Numbers Animation Cool Numbers Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

MindInventory 31 Oct 4, 2022
ColorWheel Test - An attempt at creating a Color Wheel to be utilized for color picking in SwiftUI utlizing various tutuorials on youtube

This code focuses on creating a Color Wheel in which a user will be able to select a desired color to then be implemented in another project that will display that color in an LED connected to an arduino

Gerardo Cerpa 0 Jan 15, 2022
A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.

A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code. Preview You'll be

Lorenzo Greco 2.3k Dec 31, 2022
A UIControl subclass that makes it easy to create empty states.

AZEmptyState Making empty state simple. Screenshots Installation Cocoa Pods: pod 'AZEmptyState' Manual: Simply drag and drop the Sources folder to you

Antonio Zaitoun 88 Oct 2, 2022
An UITextField subclass to simplify country code's picking. Swift 5.0

Preview Installation NKVPhonePicker is available through CocoaPods. To install it, simply add the following line to your Podfile: pod 'NKVPhonePicker'

Nike Kov 140 Nov 23, 2022
A custom UIControl which functions like UISlider where you can set multiple intervals with different step values for each interval.

MultiStepSlider A custom UIControl which functions like UISlider where you can set multiple intervals with different step values for each interval. Th

Susmita Horrow 25 Apr 28, 2022
Rotating circle menu written in Swift 3

Swift-CircleMenu A rotating circle menu written in Swift 3. Features Gesture based rotation Configurable rotatability High customisability Simple intu

Shoaib Ahmed 123 Jul 29, 2022
Fortune spinning wheel library built using SwiftUI, supports dynamic content.

Fortune Wheel Fortune spinning wheel ?? library built using SwiftUI, supports dynamic content. Preview - Spin Wheel โš™๏ธ CocoaPods Installation FortuneW

Sameer Nawaz 51 Dec 23, 2022
YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos.

YiVideoEditor YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos. YiVideoE

coderyi 97 Dec 14, 2022