NanoidSwift
Straight forward nanoid implementation for Swift.
Usage
import Nanoid
let nanoid = Nanoid.init()
nanoid.length = 8 // defaults to `32`
nanoid.alphabet = .full // defaults to `.alphameric`
print(nanoid.secureToken)
Installation
Via Carthage
Nanoid can be installed using Carthage. After installing Carthage just add Nanoid to your Cartfile as follows:
github "benjohnde/NanoidSwift" ~> 1.0
Via CocoaPods
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. After installing CocoaPods add NanoidSwift to your Podfile:
platform :ios, '9.0'
pod 'NanoidSwift', '~> 1.0.0'
Hints
- Currently limited to
/dev/urandom
, additional sources may be added later on. - Alphabet contains a convenience method for symbols, these may change.