Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIViewController not fully instantiated? #11

Open
howlingblast opened this issue May 18, 2020 · 0 comments
Open

UIViewController not fully instantiated? #11

howlingblast opened this issue May 18, 2020 · 0 comments

Comments

@howlingblast
Copy link

howlingblast commented May 18, 2020

Hi there,

while I would love this little gem of a framework to work, I can't get it to work with the smallest example.

I created a new project (Xcode 11, basic singe view app for iOS) added a second view controller and followed the instructions found in the lightning talk https://www.youtube.com/watch?v=mtBBlml759k.

Unfortunately I will end with

Unexpectedly found nil while implicitly unwrapping an Optional value

in the second view controller (line #26 outputLabel.text = input).

It seems to me that the second view controller is not fully instantiated. I tried with a xib file to no avail.

Any hints what I'm doing wrong? Am I missing something?

A small example would work wonders. Thanks for the novel approach.

MainViewController.swift

import UIKit
import StoryFlow

class ViewController: UIViewController, OutputProducing {
    typealias OutputType = String

    @IBOutlet weak var inputTextField: UITextField!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }

    @IBAction func buttonTapped(_ sender: Any) {
        produce(inputTextField.text ?? "")
    }
}

SecondViewController.swift

import UIKit
import StoryFlow

class SecondViewController: UIViewController, InputRequiring {

    typealias InputType = String

    @IBOutlet weak var outputLabel: UILabel!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        outputLabel.text = input
    }
}

Both view controller are within the default storyboard. Verified class for the second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant