TestsTested | โ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jul 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | โ |
Maintained by Macabeus.
Simple code screen for tvOS
You can download this repository and see this example app.
In Podfile
add
pod 'TvCodeScreen'
and use pod install
.
Create a new UIView and set CodeInputView
as a custom class
In Attribute Inspector tab you can change the code length and colors. The default code length value is 6 characters.
Then, your view controller need subscriber the CodeInputViewDelegate
protocol. For example:
class ViewController: UIViewController {
@IBOutlet weak var myCodeInputView: CodeInputView!
@IBOutlet weak var labelResult: UILabel!
override func viewDidLoad() {
myCodeInputView.delegate = self
}
}
extension ViewController: CodeInputViewDelegate {
func finishTyping(_ codeInputView: CodeInputView, codeText: String) {
if codeText == "42" {
labelResult.text = "Yes! Good number! ๐"
} else {
labelResult.text = "No! Wrong number! ๐ฅ"
}
}
}
The function finishTyping(codeInputView:codeText:)
is called when the user fill the code, and the parameter codeText
is the text typed by user.
Maintainer: