Pass an array to a function in Swift throwing invalid parameter type error -
pretty basic question here has me stuffed...
i'm trying call function (defined in class) using method:
var idarray = profile.getidarray(globals.friendlist);
where globals.friendlist array of profiles (i.e. [profile?] )
now here function .getidarray
func getidarray(inputarray:[profile?]) -> [string] { //blah - code returns array of strings }
whenever try compile keep getting following error:
cannot invoke 'getidarray' argument list of type '([profile?])'
now here i'm confused - because i'm pretty function is accepting [profile?] parameter type!
what's going wrong - there introduced in swift unaware of?
you invoking getidarray type method. missing class
or static
keyword in func declaration:
class func getidarray(... // if profile class static func getidarray(... // if profile struct or enum
Comments
Post a Comment