Skip to content

Commit

Permalink
Updated playground examples and types for nested type chagnes
Browse files Browse the repository at this point in the history
Fix old error in "ShowPassword" segue string
  • Loading branch information
ryanbooker committed Nov 30, 2015
1 parent 0867979 commit 9354d02
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,57 +47,55 @@ extension UIViewController {
}
}

extension UIStoryboard {
struct Scene {
enum Wizard : String, StoryboardSceneType {
static let storyboardName = "Wizard"

case CreateAccount = "CreateAccount"
static func createAccountViewController() -> CreateAccViewController {
return Wizard.CreateAccount.viewController() as! CreateAccViewController
}

case AcceptCGU = "Accept-CGU"
static func acceptCGUViewController() -> UIViewController {
return Wizard.AcceptCGU.viewController()
}

case ValidatePassword = "Validate_Password"
static func validatePasswordViewController() -> UIViewController {
return Wizard.ValidatePassword.viewController()
}

case Preferences = "Preferences"
static func preferencesViewController() -> UIViewController {
return Wizard.Preferences.viewController()
}
struct StoryboardScene {
enum Wizard : String, StoryboardSceneType {
static let storyboardName = "Wizard"

case CreateAccount = "CreateAccount"
static func createAccountViewController() -> CreateAccViewController {
return Wizard.CreateAccount.viewController() as! CreateAccViewController
}
}

struct Segue {
enum Wizard : String, StoryboardSegueType {
case Custom = "Custom"
case Back = "Back"
case NonCustom = "NonCustom"
case ShowPassword = "ShowP//: #### Usage Example
assword"

case AcceptCGU = "Accept-CGU"
static func acceptCGUViewController() -> UIViewController {
return Wizard.AcceptCGU.viewController()
}

case ValidatePassword = "Validate_Password"
static func validatePasswordViewController() -> UIViewController {
return Wizard.ValidatePassword.viewController()
}

case Preferences = "Preferences"
static func preferencesViewController() -> UIViewController {
return Wizard.Preferences.viewController()
}
}
}

struct StoryboardSegue {
enum Wizard : String, StoryboardSegueType {
case Custom = "Custom"
case Back = "Back"
case NonCustom = "NonCustom"
case ShowPassword = "ShowPassword"
}
}

//: #### Usage Example

let initialVC = UIStoryboard.Scene.Wizard.initialViewController()
let initialVC = StoryboardScene.Wizard.initialViewController()
initialVC.title

let validateVC = UIStoryboard.Scene.Wizard.ValidatePassword.viewController()
let validateVC = StoryboardScene.Wizard.ValidatePassword.viewController()
validateVC.title

/* Note: the following line would crash when run in playground, because the storyboard file
was not compiled alongside the playground code, so the CreateAccViewController class was
not known by the storyboard. But it should work correctly in a real project. */
// let cgu = UIStoryboard.Scene.Wizard.createAccountViewController()

let segue = UIStoryboard.Segue.Wizard.ShowPassword
let segue = StoryboardSegue.Wizard.ShowPassword
initialVC.performSegue(segue)

switch segue {
Expand All @@ -117,4 +115,4 @@ segues for a specific storyboard.
// case .Custom:
// // Prepare for your custom segue transition
// case .NonCustom:
// // Pass in information to the destinatio
// // Pass in information to the destinatio
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
version = "3.0">
<TimelineItems>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=16&amp;CharacterRangeLoc=2802&amp;EndingColumnNumber=17&amp;EndingLineNumber=90&amp;StartingColumnNumber=1&amp;StartingLineNumber=90&amp;Timestamp=468444495.830892"
documentLocation = "#CharacterRangeLen=14&amp;CharacterRangeLoc=2321&amp;EndingColumnNumber=17&amp;EndingLineNumber=85&amp;StartingColumnNumber=1&amp;StartingLineNumber=85&amp;Timestamp=470544891.833411"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=15&amp;CharacterRangeLoc=2707&amp;EndingColumnNumber=16&amp;EndingLineNumber=87&amp;StartingColumnNumber=1&amp;StartingLineNumber=87&amp;Timestamp=468444495.831127"
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=1174&amp;EndingColumnNumber=16&amp;EndingLineNumber=82&amp;StartingColumnNumber=1&amp;StartingLineNumber=82&amp;Timestamp=470544864.341099"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=15&amp;CharacterRangeLoc=2514&amp;EndingColumnNumber=16&amp;EndingLineNumber=81&amp;StartingColumnNumber=1&amp;StartingLineNumber=81&amp;Timestamp=468444495.831296"
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=1174&amp;EndingColumnNumber=16&amp;EndingLineNumber=76&amp;StartingColumnNumber=1&amp;StartingLineNumber=76&amp;Timestamp=470544864.341273"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=16&amp;CharacterRangeLoc=2608&amp;EndingColumnNumber=17&amp;EndingLineNumber=84&amp;StartingColumnNumber=1&amp;StartingLineNumber=84&amp;Timestamp=468444495.831458"
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=1174&amp;EndingColumnNumber=17&amp;EndingLineNumber=79&amp;StartingColumnNumber=1&amp;StartingLineNumber=79&amp;Timestamp=470544864.341445"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
Expand Down

0 comments on commit 9354d02

Please sign in to comment.