I am looking for a documentation for @IBSegueAction and valid method signatures? Variants are welcomed.
CodePudding user response:
The basic signature is:
First parameter is an NSCoder
Second parameter (the sender) is an
Any?
and may be omitted if the third parameter is omittedThird parameter (the segue identifier) is a
String?
and may be omittedResult 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.]