Good afternoon!
I'm relatively new to Swift, though I think I've managed to wrap my head around most of it, however I'm having difficulties setting a segue's destinationViewController indirectly.
I understand that destinationViewController accepts AnyObject? but how do I go about returning the class as a function's return value directly to destinationViewController? Something like:
override func prepareForSegue( segue: UIStoryboardSegue, sender: AnyObject? ) {
if( segue.identifier == "nextView" ) {
let nextScene = segue.destinationViewController as? getNextView()
// ...blah blah blah...
}
}
Where getNextView() is overridden by a subclass whose sole purpose is to return a reference to the destinationViewController:
override func getNextView -> AnyObject! {
return SomeClassBasedOnUIViewController
}
XCode isn't happy I'm employing "consecutive statements" on one line in my prepareForSegue() and I'm at a loss how to resolve it so any help would be greatly appreciated!
Thanks!
EDIT:
Sorry about that, but getNextView() doesn't actually return an Optional. Just picked up on that and amended the question. The issue persists regardless, though.
destinationViewController shouldn't be optional. Can you try this one.