A simple StackView to be used for Passcode or OTP fields. Completely customisable with separate classes and very easy to use. Just Drag and drop with 2 lines of code.
2. Drag horizontol UIStackView from UIElement Collection into the storyboard and Give it custom name as 'PinView'
@IBOutlet weak var viewOTP: PinView!
viewOTP.setUpView()
viewOTP.textFields[0].becomeFirstResponder()
var config:PinConfig! = PinConfig()
config.otpLength = .four
config.dotColor = .black
config.lineColor = #colorLiteral(red: 0.8265652657, green: 0.8502194881, blue: 0.9000532627, alpha: 1)
config.spacing = 20
config.isSecureTextEntry = false
config.showPlaceHolder = false
viewOTP.config = config
viewOTP.setUpView()
viewOTP.textFields[0].becomeFirstResponder()