ios - Swift append gives missed argument error -
my code fine before adding color: uicolor
existing class. after adding color: uicolor
append part of code giving error (missing ',' argument).
i have pasted part of code. please see bottom line error.
import foundation import uikit class destinationtype { var name: string // name of destination type var destinations : [destination] // destinations in type init (name:string, includedestination:[destination]) { self.name = name self.destinations = includedestination } class func destinationtypes() -> [destinationtype] { return [self.summer(), self.winter()] } private class func summer() -> destinationtype { var destinations = [destination]() destinations.append(destination(name: "antalya", description: "very", imagename: "antalya.png", color: uicolor.greencolor)
// expected ',' seperator }
if need, find class file below.
import foundation import uikit class destination { var name : string var description : string var image : uiimage var color : uicolor init (name:string, description:string, imagename:string, color:uicolor) { self.name = name self.description = description if let img = uiimage(named: imagename) { image = img } else { image = uiimage(named: "default")! } self.color = color } }
greencolor
misses parentheses. needs greencolor()
.
swift's error messages more misleading giving hint wrong :-(
Comments
Post a Comment