Latest1.0.3
Homepagehttps://github.com/saeid/GDTextSlot
LicenseMIT
Platformsios 9.0, requires ARC
FrameworksUIKit
Authors

Simple component for code input texts with easy setup and inspector support.

slotview



Requirments

  • Xcode 9+
  • Swift 4
  • iOS 8+

How to use

drag GDTextSlot.swift to your project and use!

Or using Cocoapods

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
pod 'GDTextSlot'
end

pod update then pod install


Sample

  • Create it with code
    
    let frame = CGRect(x: 0, y: 0, width: 300, height: 60)
    let slotView = GDTextSlot(frame: frame)
    slotView.delegate = self
    view.addSubview(slotView)

// if you want it to be activated at first!. it will be activated on touch.
//slotView.becomeFirstResponder()

// KeyboardType can be set like this. default is .numberPad
slotView.keyboard = .default

// Change number of available slots. default is 4
slotView.numberOfSlots = 6

// Change space between slots. default is 30
slotView.baseWidth = 40


- Storyboard
1) Add view to storyboard and set custom class to `GDTextSlot`
2) Change attributes through attribute inspector

and run!

For getting entered text add delegate method

```swift

func onTextEntered(_ slotView: GDTextSlot, _ finalText: String) {
    print(finalText)
}

do not forget to set GDTextSlotDelegate to view controller.

Latest podspec

{
    "name": "GDTextSlot",
    "version": "1.0.3",
    "summary": "Simple component for code input!",
    "homepage": "https://github.com/saeid/GDTextSlot",
    "license": "MIT",
    "authors": {
        "Saeid Basirnia": "[email protected]"
    },
    "source": {
        "git": "https://github.com/saeid/GDTextSlot.git",
        "tag": "1.0.3"
    },
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "swift_version": "4.0",
    "source_files": "*.swift",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This