Skip to content

Commit

Permalink
For LinkedStoryboardModalSegue, show the dest from the source. naviga…
Browse files Browse the repository at this point in the history
…tionController was nil.
  • Loading branch information
preble committed Sep 15, 2015
1 parent 89e21c8 commit f27a285
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions LinkedStoryboardSegue/LinkedStoryboardModalSegue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class LinkedStoryboardModalSegue : LinkedStoryboardSegue {
// gather our view controllers
let source = self.sourceViewController
let destination = self.destinationViewController
// Since this is a moda, a UINavigationController should be ok, not fiing like in the baseClass
// push it real good...
source.navigationController?.presentViewController(destination, animated:true, completion:nil)
// Since this is a modal, a UINavigationController should be ok, not fiing like in the baseClass
source.showViewController(destination, sender: self)
}
}
6 changes: 5 additions & 1 deletion LinkedStoryboardSegue/LinkedStoryboardSegue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public class LinkedStoryboardSegue : UIStoryboardSegue{
// fix the destination should it be a UINavigationController (that's no good in a push)
destination = fixDestinationViewControllerForNavigationRootControllers(destination)
// push it real good...
source.navigationController?.pushViewController(destination, animated:true)
guard let navigationController = source.navigationController else {
print("LinkedStoryboardSegue.perform(): Source \(source) has no navigationController")
return
}
navigationController.pushViewController(destination, animated:true)
}


Expand Down

0 comments on commit f27a285

Please sign in to comment.