Latest 0.0.2-beta
Homepage https://github.com/brunomacabeusbr/InputStepByStep
License MIT
Platforms tvos 10.0
Dependencies Cartography
Authors

Version
License
Platform

📝 A input view for tvOS, useful for testing purposes.

"Hey, but it is horrible to enter input in AppleTV!"
Yes, I know, but in some cases it is useful for testing, when you are using simulator or testing in physical device with iPhone.

You can download this repository and see this example app.

How to use

Install

In Podfile add

pod 'InputStepByStep'

and use pod install.

Setup

Storyboard

  1. Create a Container View
  2. Change the View Controller for Collection View Controller
  3. Set InputStepByStep as a custom class

Set fields

Your controller that will manager a InputStepByStep need subscriber the protocol InputStepByStepProtocol

Minimal example:

class ViewController: UIViewController, InputStepByStepProtocol {

    @IBOutlet weak var container: UIView!
    var containerStepByStep: InputStepByStep?

    var configList: [CellCreateGrid] = [ // set the inputs
        .name("Login"),
        .input(name: "user", label: "User"),
        .input(name: "password", label: "Password"),
        .input(name: "email", label: "E-Mail"),

        .name("Personal infos"),
        .input(name: "firtname", label: "Your first name"),
        .input(name: "lastname", label: "Your last name"),

        .finish() // you need set the ".finish" at the end of "configList"
    ]

    func cellFinishAction(inputValues: [String: [String: String]]) { // when the user click in green button
        if let user = inputValues["Login"]?["user"],
            let password = inputValues["Login"]?["password"],
            let email = inputValues["Login"]?["email"] {

            print("create account with login (user), password (password) and email (email)")
        }
    }

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

        if segue.identifier == "segueInputStepyBtStep" {
            self.containerStepByStep = (segue.destination as! InputStepByStep)
            self.containerStepByStep!.delegate = self // set a delegate where
        }
    }
}

The configList is a list of inputs that InputStepByStep will show.
You use .name(String) to create a division and .input(name: String, label: String to create a input. And, at the end, you need add .finish() to create a green button.

The function cellFinishAction(inputValues:) is called when the green button is clicked.
The parameters in inputValues is a dictionary with key as the name of division ("Login" or "Personal infos" in example) and value is another dictionary, with key as the name of input ("email", for example) and the value is the value setted by user.

Latest podspec

{
    "name": "InputStepByStep",
    "version": "0.0.2-beta",
    "summary": "A simple input view for tvOS, for testing purposes",
    "homepage": "https://github.com/brunomacabeusbr/InputStepByStep",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Bruno Macabeus": "[email protected]"
    },
    "platforms": {
        "tvos": "10.0"
    },
    "source": {
        "git": "https://github.com/brunomacabeusbr/InputStepByStep.git",
        "tag": "0.0.2-beta"
    },
    "source_files": [
        "InputStepByStep/InputStepByStep/*.swift",
        "InputStepByStep/InputStepByStep/*.xib"
    ],
    "dependencies": {
        "Cartography": [
            "~> 1.1"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This