Text formatting framework written for SwiftUI and based on AnyFormatKit.
Demo
Requirements
- iOS 13.0+
- Swift 4.0+
- Xcode 11.0+
Installation
Swift Package Manager
AnyFormatKit is available with Swift Package Manager.
Once you have your Swift package set up, than simply add AnyFormatKitSwiftUI to the dependencies
value of your Package.swift
dependencies: [
.package(url: "https://github.com/luximetr/AnyFormatKitSwiftUI.git", .upToNextMajor(from: "0.5.3"))
]
CocoaPods
AnyFormatKitSwiftUI is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'AnyFormatKitSwiftUI', '~> 0.5.3'
Then, run the following command:
$ pod install
Usage
import SwiftUI
import AnyFormatKitSwiftUI
struct ContentView: View {
@State var text = ""
var body: some View {
FormatTextField(
unformattedText: $text,
textPattern: "### (###) ###-##-##"
)
}
}
For more details look example
TextField types
FormatTextField
- formatting symbol by symbolFormatSumTextField
- formatting like a money formatFormatStartTextField
- formatting with all textPattern as placeholder
Features
Features | |
---|---|
Formatting text during typing | |
Set format using '#' characters like '### ##-###' | |
Supporting emojis | |
Formatting money amount | |
Formatting with placeholders |
Author
luximetr, [email protected]
Say thank you
License
AnyFormatKitSwiftUI is available under the MIT license. See the LICENSE file for more info.