Swiftpack.co - iAmrMohamed/DigitEntryView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by iAmrMohamed.
iAmrMohamed/DigitEntryView 1.0.0
Simple iOS digit input field for OTP codes
⭐️ 0
🕓 2 weeks ago
iOS
.package(url: "https://github.com/iAmrMohamed/DigitEntryView.git", from: "1.0.0")

DigitEntryView

Simple iOS digit input field for OTP codes

Installation

DigitEntryView is currently available either manually by cloning the project and adding DigitEntryView.swift to your project, or you can use the Swift Package Manager (SPM).

  • In Xcode, click File > Swift Packages > Add Package Dependency.
  • In the dialog that appears, enter the repository URL: https://github.com/iAmrMohamed/DigitEntryView.git
  • In Version, select Up to Next Major and take the default option.
  • Click Next and select the library DigitEntryView checkbox, then click Finish and your're all set.

Requirements

  • Requires iOS 9.0+

Usage

Storyboard

Drag a UIView object and set the class to DigitEntryView (if needed set the module to DigitEntryView too).

Programmatically

import DigitEntryView

let digitEntryView = DigitEntryView()

// defaults to 6
digitEntryView.numberOfDigits = 5

// optional properties
digitEntryView.spacing = 20
digitEntryView.digitColor = UIColor.black
digitEntryView.digitFont = .systemFont(ofSize: 20)

// circle digits
digitEntryView.digitCornerStyle = .circle

// set a specific corner radius for digits
digitEntryView.digitCornerStyle = .radius(15)

digitEntryView.digitBorderColor = UIColor.lightGray
digitEntryView.nextDigitBorderColor = UIColor.blue

// set the delegate to get callback for
// when a digit changes or when the digits gets filled
digitEntryView.delegate = self

Delegate Callbacks

func digitsDidFinish(_ digitEntryView: DigitEntryView) {

}

func digitsDidChange(_ digitEntryView: DigitEntryView) {

}

Author

@iAmrMohamed

License

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

GitHub

link
Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics