Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Enhancements on SegueProtocol #24

Merged
merged 1 commit into from
May 11, 2015
Merged

Enhancements on SegueProtocol #24

merged 1 commit into from
May 11, 2015

Conversation

marcelofabri
Copy link
Contributor

The goal of this PR is making implementing prepareForSegue easier.

To do so, some changes were necessary:

  • SegueProtocol inherits from Equatable
  • UIStoryboardSegue implements SegueProtocol (identifier is now optional to match UIStoryboardSegue declaration)

Now, you can do something like this:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue == ViewController.Segue.MySegue {

    }
}

@krzyzanowskim
Copy link
Owner

good job

krzyzanowskim added a commit that referenced this pull request May 11, 2015
Enhancements on SegueProtocol
@krzyzanowskim krzyzanowskim merged commit 3d2b6d2 into krzyzanowskim:master May 11, 2015
@@ -843,7 +843,7 @@ class StoryboardFile {
println(" }")
println(" }")
println()
println(" var identifier: String { return self.description } ")
println(" var identifier: String? { return self.description } ")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this one. Why optional here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because UIStoryboardSegue already has an identifier property, which is optional.
As I wanted to make UIStoryboardSegue conform to SegueProtocol, this was the easiest way.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thansks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants