seg

SegueAddition

Easily way to write perfromSegueWithIdentifier.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

41

Maintenance

Last Commit

3yrs ago

Contributors

2

Package

Dependencies

0

License

MIT

Categories

Readme

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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100