Skip to content

Commit

Permalink
performSegue extension method on viewcontroller
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-cain13 committed Dec 1, 2015
1 parent ae13050 commit 841f4ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions R.swift/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ do {
ReuseIdentifierUITableViewExtension.description,
ReuseIdentifierUICollectionViewExtension.description,
NibUIViewControllerExtension.description,
SegueUIViewControllerExtension.description,
].joinWithSeparator("\n\n")

// Write file if we have changes
Expand Down
20 changes: 19 additions & 1 deletion R.swift/values.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ let ReuseIdentifier = Struct(
functions: [],
structs: [])

let StoryboardSegueType = Type(name: "StoryboardSegue", genericArgs: ["Source", "Destination"])

let StoryboardSegue = Struct(
type: Type(name: "StoryboardSegue", genericArgs: ["Source", "Destination"]),
type: StoryboardSegueType,
implements: [Type(name: "CustomStringConvertible")],
lets: [
Let(
Expand Down Expand Up @@ -114,6 +115,23 @@ let NibUIViewControllerExtension = Extension(
]
)

let SegueUIViewControllerExtension = Extension(
type: Type._UIViewController,
functions: [
Function(
isStatic: false,
name: "performSegue",
generics: StoryboardSegueType.genericArgs.joinWithSeparator(","),
parameters: [
Function.Parameter(name: "segue", type: StoryboardSegueType),
Function.Parameter(name: "sender", type: Type._AnyObject.asOptional())
],
returnType: Type._Void,
body: "performSegueWithIdentifier(segue.identifier, sender: sender)"
),
]
)

let ReuseIdentifierUITableViewExtension = Extension(
type: Type._UITableView,
functions: [
Expand Down

0 comments on commit 841f4ed

Please sign in to comment.