This repository has been archived by the owner on Sep 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AliSoftware proposed another idea, that we could add to this template (or an alternative one): protocol MyViewControllerTypedStoryboardSegue {
func prepareSegueForEmbed(destination: EmbedDestinationVC)
func prepareSegueForModal(destination: ModalDestionationVC)
…
func prepare(for segue: NSStoryboardSegue, sender: Any?)
}
extension MyViewControllerTypedStoryboardSegue {
func prepare(for segue: NSStoryboardSegue, sender: Any?) {
/* generate that switch/case implementation here which calls the proper prepareSegueForXXX(destionation:) method */
}
} There could be issues here because of Another proposal was: /* Generated by SwiftGen */
protocol MyViewControllerTypedStoryboardSegue {
func prepareSegueForEmbed(destination: EmbedDestinationVC)
func prepareSegueForModal(destination: ModalDestionationVC)
…
func prepare(for segue: NSStoryboardSegue)
}
extension MyViewControllerTypedStoryboardSegue {
func prepare(for segue: NSStoryboardSegue) {
/* generate that switch/case implementation here which calls
the proper prepareSegueForXXX(destionation:) method */
}
}
/* Added by the user */
extension MyViewController: MyViewControlelrTypedStoryboardSegue {
@objc func prepare(for segue: NSStoryboardSegue, sender: Any?) {
self.prepare(for: segue)
}
} I'd probably rename the function here, because users want access to the sender argument so we'd need to pass it along. |
Had to change a class name because of https://bugs.swift.org/browse/SR-898 (module and class name with same name)
I'm going to wait on #36 to fix the last compilation issue (for the |
This was referenced Dec 5, 2017
Open
Archiving this in favour of SwiftGen/SwiftGen#364. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SwiftGenKit PR: SwiftGen/SwiftGenKit#54
Uses the improvements added in SwiftGenKit to generate extensions for non-base classes (UIKit/AppKit), so that a user can:
For performing a segue, the user goes from:
To:
For preparing for a segue, the user goes from:
To: