bannzai / Segueaddition
Licence: mit
Easily way to write perfromSegueWithIdentifier.
Stars: ✭ 40
Programming Languages
swift
15916 projects
SegueAddition
Easily way to write perfromSegue(withIdentifier:sender).
Usage
You can call performSegue
with closure.
let customString = "CustomString"
performSegue("SegueIdentfiier") { segue in
guard let toViewController = segue.destinationViewController as? CustomViewController else {
fatalError()
}
toViewController.string = customString
}
It has the same meaning.
...
let customString = "CustomString"
performSegueWithIdentifier("SegueIdentfiier", sender: customString)
...
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let toViewController = segue.destinationViewController as? CustomViewController,
customString = sender as? String
where segue.identifier == "SegueIdentfiier"
else {
fatalError()
}
toViewController.string = customString
}
So, no need to write prepare(for segue: UIStoryboardSegue, sender: Any?)
again.
And, It is read and write easy for perform segue event and passing value to next view controller.
LICENSE
SegueAddition is released under the MIT license. See LICENSE for details.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].