All Projects → SiarheiFedartsou → MeasurementTextField

SiarheiFedartsou / MeasurementTextField

Licence: MIT license
UITextField-based control for (NS)Measurement values input.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to MeasurementTextField

Swifticonfont
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon)
Stars: ✭ 1,094 (+6737.5%)
Mutual labels:  uitextfield
Placeholders
🅿️ Define multiple placeholders for UITextField and animate their change
Stars: ✭ 190 (+1087.5%)
Mutual labels:  uitextfield
meazure
Screen magnification, measurement, capture and color sampling for Windows.
Stars: ✭ 55 (+243.75%)
Mutual labels:  measurement
Swiftcocoadsl
An easy way to write iOS UI
Stars: ✭ 103 (+543.75%)
Mutual labels:  uitextfield
Closures
Swifty closures for UIKit and Foundation
Stars: ✭ 1,720 (+10650%)
Mutual labels:  uitextfield
Dttextfield
DTTextField is a custom textfield with floating placeholder and error label
Stars: ✭ 213 (+1231.25%)
Mutual labels:  uitextfield
Sgdigittextfield
Elegant and Simplest Digit UITextField
Stars: ✭ 47 (+193.75%)
Mutual labels:  uitextfield
react-native-startup-time
measure startup time of your react-native app
Stars: ✭ 88 (+450%)
Mutual labels:  measurement
Underlinetextfield
Simple UITextfield Subclass with state
Stars: ✭ 156 (+875%)
Mutual labels:  uitextfield
ARGoal
Get more goals. | Virtual Goals & Goal Distance | App Doctor Hu
Stars: ✭ 14 (-12.5%)
Mutual labels:  measurement
Rsfloatinputview
A Float Input View with smooth animation and supporting icon and seperator written with Swift
Stars: ✭ 103 (+543.75%)
Mutual labels:  uitextfield
Acfloatingtextfield
It is a subclass of UITextfield to Provide the floating label and customisations.
Stars: ✭ 110 (+587.5%)
Mutual labels:  uitextfield
Awesometextfieldswift
Awesome TextField is a nice and simple libriary for iOS and Mac OSX. It's highly customisable and easy-to-use tool. Works perfectly for any registration or login forms in your app.
Stars: ✭ 221 (+1281.25%)
Mutual labels:  uitextfield
Afviewshaker
Stars: ✭ 1,214 (+7487.5%)
Mutual labels:  uitextfield
snippet-timekeeper
An android library to measure code execution time. No need to remove the measurement code, automatically becomes no-op in the release variants. Does not compromise with the code readability and comes with features that enhance the developer experience.
Stars: ✭ 70 (+337.5%)
Mutual labels:  measurement
Currencytextfield
UITextField that automatically formats text to display in the currency format
Stars: ✭ 47 (+193.75%)
Mutual labels:  uitextfield
Downpicker
A lightweight DropDownList / ComboBox for iOS, written in Objective-C
Stars: ✭ 201 (+1156.25%)
Mutual labels:  uitextfield
NSJTextField
A custom textfield with the placeholder displayed on top when text entered.
Stars: ✭ 30 (+87.5%)
Mutual labels:  uitextfield
RZColorful
NSAttributedString富文本的方法集合,以及简单优雅的使用其多种属性
Stars: ✭ 53 (+231.25%)
Mutual labels:  uitextfield
Ragtextfield
Subclass of UITextField that adds an animated placeholder and an optional hint label below the text.
Stars: ✭ 227 (+1318.75%)
Mutual labels:  uitextfield

MeasurementTextField

CI Status Version License Platform

UITextField-based control for (NS)Measurement values input. Provides type-safe keyboard and picker based input of different measurements(such as length, mass, speed etc). See example app for API details.

Screenshots

Screenshot 1Screenshot 2

Example Usage

First of all you need to import MeasurementTextField:

import MeasurementTextField

Need text field for angle input? Just write:

let angleTextField = MeasurementTextField<UnitAngle>(inputType: .keyboard(.degrees))

Instead of UnitAngle you can use any Dimension type defined in Foundation or implement own Dimension subclass if you need something special. Then to obtain Measurement value inputted by user just use value property:

if let value = angleTextField.value {
    let formatter = MeasurementFormatter()
    print("Your input is \(formatter.string(from: value))!")
} else {
    print("You cleared the field!")
}

Degrees input is not enough? Want also arc minutes and arc seconds? Just use another input type:

let angleTextField = MeasurementTextField<UnitAngle>(inputType: .picker([
    PickerColumn(unit: UnitAngle.degrees, range: 0...360, step: 1.0), // `step` is optional here, 1.0 by default
    PickerColumn(unit: UnitAngle.arcMinutes, range: 0...60),
    PickerColumn(unit: UnitAngle.arcSeconds, range: 0...60),
]))

Need to be notified when value is changed? Just subscribe on UIControlEvents.valueChanged:

@objc private func onAngleValueChanged() {
    print("Angle value was changed!")
}
angleTextField.addTarget(self, action: #selector(onAngleValueChanged), for: .valueChanged)

Customization

To change text color of measurement unit label for .keyboard input type just change tintColor:

angleTextField.tintColor = .red

Want to remove it completely? Just pass showMeasureUnit: false in input type configuration:

let angleTextField = MeasurementTextField<UnitAngle>(inputType: .keyboard(.degrees, showMeasureUnit: false))

Also be aware that MeasurementTextField is an usual UITextField, so you can use all APIs provided by it, except of textField(_:shouldChangeCharactersIn:replacementString:) delegate method.

Example

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

Requirements

  • Swift 4

Issues

If you need some feature or you found a bug feel free to open an issue.

Installation

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

pod 'MeasurementTextField'

Author

SiarheiFedartsou, [email protected]

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].