Home > Blockchain >  What are @IBSegueAction valid method signatures?
What are @IBSegueAction valid method signatures?

Time:10-09

I am looking for a documentation for @IBSegueAction and valid method signatures? Variants are welcomed.

CodePudding user response:

The basic signature is:

  1. First parameter is an NSCoder

  2. Second parameter (the sender) is an Any? and may be omitted if the third parameter is omitted

  3. Third parameter (the segue identifier) is a String? and may be omitted

  4. Result is an Optional or non-Optional UIViewController or some subclass thereof. If it is Optional and you return nil, then the instantiation proceeds as if this call had never been made.

We may exemplify those rules by this declaration:

@IBSegueAction 
func f(coder:NSCoder, sender:Any?, ident:String?) -> UIViewController? {

with the understanding that all that matters is the signature: the function name and the parameter labels don't matter, the third or second-and-third parameters may be omitted, and the result type is rather broad in the way I've already outlined.

[Original documentation here, the rest determined by experimentation.]

  • Related