https://github.com/macabeus/tvcodescreen
๐ Apple TV | Simple code screen
https://github.com/macabeus/tvcodescreen
Last synced: 9 months ago
JSON representation
๐ Apple TV | Simple code screen
- Host: GitHub
- URL: https://github.com/macabeus/tvcodescreen
- Owner: macabeus
- License: mit
- Created: 2017-06-29T06:51:49.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-04T21:44:46.000Z (over 8 years ago)
- Last Synced: 2025-08-18T13:51:22.086Z (10 months ago)
- Language: Swift
- Homepage: https://cocoapods.org/pods/TvCodeScreen
- Size: 37.1 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://cocoapods.org/pods/TvCodeScreen)
[](http://cocoapods.org/pods/TvCodeScreen)
[](http://cocoapods.org/pods/TvCodeScreen)
[](https://travis-ci.org/getstalkr/TvCodeScreen)
[](https://codecov.io/gh/getstalkr/TvCodeScreen/branch/master)
# TvCodeScreen
Simple code screen for tvOS

You can download this repository and see this example app.
# How to use
## Install
In `Podfile` add
```
pod 'TvCodeScreen'
```
and use `pod install`.
## Setup
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:
```swift
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.
# TODO
- [ ] Use dynamic type
- [ ] Suport for letters
**Maintainer**:
> [macabeus](http://macalogs.com.br/) ย ยทย
> GitHub [@macabeus](https://github.com/macabeus)