All Projects → luximetr → Anyformatkit

luximetr / Anyformatkit

Licence: mit
Simple text formatting in Swift

Programming Languages

swift
15916 projects
symbols
36 projects

Projects that are alternatives of or similar to Anyformatkit

Uitextfield Navigation
🏄‍♂️ UITextField-Navigation makes it easier to navigate between UITextFields and UITextViews
Stars: ✭ 436 (+47.3%)
Mutual labels:  xcode, cocoapods, carthage, uitextfield, uitextview
Pincodeinputview
A input text view for entering pin code.
Stars: ✭ 108 (-63.51%)
Mutual labels:  cocoapods, carthage, uitextfield, uitextview
Audioindicatorbars
AIB indicates for your app users which audio is playing. Just like the Podcasts app.
Stars: ✭ 279 (-5.74%)
Mutual labels:  xcode, cocoapods, carthage
Croc
Swift emoji string parsing library
Stars: ✭ 124 (-58.11%)
Mutual labels:  xcode, cocoapods, carthage
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (-46.62%)
Mutual labels:  xcode, cocoapods, carthage
Shari
Shari is the alternative to the library of UIPickerView(drum roll) in Swift. You can select a item using UITableView.
Stars: ✭ 111 (-62.5%)
Mutual labels:  xcode, cocoapods, carthage
Microfeatures Example
📦📱 Example of iOS app built using the uFeatures architecture
Stars: ✭ 112 (-62.16%)
Mutual labels:  xcode, cocoapods, carthage
Donut
Donut is a library for arranging views circularly like a donut.
Stars: ✭ 141 (-52.36%)
Mutual labels:  xcode, cocoapods, carthage
Nextgrowingtextview
📝 The next in the generations of 'growing textviews' optimized for iOS 8 and above.
Stars: ✭ 1,540 (+420.27%)
Mutual labels:  xcode, cocoapods, carthage
Imageloaderswift
A lightweight and fast image loader for iOS written in Swift.
Stars: ✭ 290 (-2.03%)
Mutual labels:  xcode, cocoapods, carthage
Shsearchbar
The search bar that doesn't suck.
Stars: ✭ 206 (-30.41%)
Mutual labels:  xcode, cocoapods, carthage
Localize
Localize is a framework writed in swift to localize your projects easier improves i18n, including storyboards and strings.
Stars: ✭ 253 (-14.53%)
Mutual labels:  xcode, cocoapods, carthage
Device
Light weight tool for detecting the current device and screen size written in swift.
Stars: ✭ 1,503 (+407.77%)
Mutual labels:  xcode, cocoapods, carthage
Alamofire
Elegant HTTP Networking in Swift
Stars: ✭ 36,896 (+12364.86%)
Mutual labels:  xcode, cocoapods, carthage
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-59.8%)
Mutual labels:  xcode, cocoapods, carthage
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+3516.89%)
Mutual labels:  xcode, cocoapods, carthage
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (-55.74%)
Mutual labels:  xcode, cocoapods, carthage
Netfox
A lightweight, one line setup, iOS / OSX network debugging library! 🦊
Stars: ✭ 3,188 (+977.03%)
Mutual labels:  xcode, cocoapods, carthage
Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-69.59%)
Mutual labels:  xcode, cocoapods, carthage
Pluggableappdelegate
!! No longer supported !! A lightweight service-oriented AppDelegate for iOS, made in Swift.
Stars: ✭ 96 (-67.57%)
Mutual labels:  xcode, cocoapods, carthage

AnyFormatKit: Simple text formatting in Swift

CI Status Pod Version License Platform SwiftPM compatible Swift

Text formatting framework written on Swift 5.0.

Features

Features
🎭 Convert string into formatted string and vice versa
🚴 Formatting text during typing
#️⃣ Set format using '#' characters like '### ##-###'
😛 Supporting emojis
💲 Formatting money amount
🅿️ Formatting with placeholders
🌱 UITextField and UITextView support

Example

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

Demo

Phone number example

Currency example

Card number example

Placeholder number number example

Requirements

  • iOS 8.0+
  • Swift 4.0+
  • Xcode 9.0+

SwiftUI

AnyFormatKit has SwiftUI version, that exists as separate framework AnyFormatKitSwiftUI

Migration Guides

Installation

CocoaPods

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

pod 'AnyFormatKit', '~> 2.5.0'

Then, run the following command:

$ pod install

Swift Package Manager

AnyFormatKit is available with Swift Package Manager. Once you have your Swift package set up, than simply add AnyFormatKit to the dependencies value of your Package.swift

dependencies: [
    .package(url: "https://github.com/luximetr/AnyFormatKit.git", .upToNextMajor(from: "2.5.0"))
]

Usage

Import

import AnyFormatKit

Formatting with TextFormatter

let phoneFormatter = DefaultTextInputFormatter(textPattern: "### (###) ###-##-##")
let phoneInputController = TextFieldInputController()

textField.delegate = phoneInputController
phoneInputController.formatter = phoneFormatter

Get only your input

phoneNumberFormatter.unformat("+51 (013) 442-55-11") // +51013442551 

In case you want to use textField.delegate by yourself

let phoneFormatter = DefaultTextInputFormatter(textPattern: "### (###) ###-##-##")

// inside of UITextFieldDelegate shouldChangeTextIn method
let result = formatter.formatInput(currentText: textField.text ?? "", range: range, replacementString: string)
textField.text = result.formattedText
textField.setCursorLocation(result.caretBeginOffset)

You can find example of setCursorLocation here

Formatter kinds

Author

luximetr, [email protected]

Say thank you

License

AnyFormatKit 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].