Latest 0.1.1
Homepage https://github.com/getstalkr/TvCodeScreen
License MIT
Platforms tvos 10.0
Authors

Version
License
Platform
Build Status
codecov.io

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:

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  · 
GitHub @macabeus

Latest podspec

{
    "name": "TvCodeScreen",
    "version": "0.1.1",
    "summary": "Simple code screen for tvOS",
    "homepage": "https://github.com/getstalkr/TvCodeScreen",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Bruno Macabeus": "[email protected]"
    },
    "platforms": {
        "tvos": "10.0"
    },
    "source": {
        "git": "https://github.com/getstalkr/TvCodeScreen.git",
        "tag": "0.1.1"
    },
    "source_files": [
        "TvCodeScreen/TvCodeScreen/*.swift",
        "TvCodeScreen/TvCodeScreen/*.xib"
    ],
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This