krzyzanowskim / Natalie

Natalie - Storyboard Code Generator (for Swift)
http://blog.krzyzanowskim.com/2015/04/15/natalie-storyboard-code-generator/
MIT License
1.17k stars 74 forks source link

Ambiguous use of 'selection' #44

Closed kostiakoval closed 9 years ago

kostiakoval commented 9 years ago

If there is more that 1 view controller with segue, the Swift can't find which to use Steps:

Result:

if let selection = segue.selection() { 

This code won't work. To make it work I need to manually specify type.

 if let selection: MainViewController.Segue = segue.selection()  {
krzyzanowskim commented 9 years ago

UIStoryboardSegue.selection() is actually workaround for weird switch statement behavioud. I think it will be fixed in Swift over the time.

Today preferred way to handle prepareForSegue() with Natalie is:

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue == MainViewController.Segue.ScreenOneSegue {
            /* ... */
        }
    }

See related: https://twitter.com/krzyzanowskim/status/611686899732869121