Rightpoint / Eject

An eject button for Interface Builder to generate swift code
MIT License
522 stars 24 forks source link

Add support for Storyboard segues #15

Open KingOfBrian opened 8 years ago

KingOfBrian commented 8 years ago

If anyone has opinions on how to generate code for segues, please reply here!

KingOfBrian commented 8 years ago

I think segue's can be turned into functions pretty cleanly. It won't work perfectly because it doesn't integrate with prepareSegue, but it will provide a nice migration path. So this:

<segue destination="mEm-Ej-dA4" kind="show" identifier="mainToSignInSegue" action="showDetailViewController:_:" id="dBg-ZI-lpi"/>
<segue destination="57h-AR-p0t" kind="show" identifier="mainToHomeSegue" id="YAY-rF-u8B"/>
func mainToSignInSegue() {
    let destination = ClassOfDetinationIDViewController()
    showDetailViewController(destination, sender: self)
}

func mainToHomeSegue() {
    let destination = ClassOfDetinationIDViewController()
    navigationController?.pushViewController(destination, animated: true)
}

If you know of any other segue attributes, add them here. I think there will just be a few function styles.