Open EmreKayaoglu opened 4 years ago
class Project: Mappable { var id: String? var projectName: String? var projectDescription: String? var companyId: String? var isService: Bool = false required convenience init?(map: Map) { self.init() } func mapping(map: Map) { id <- map["_id"] projectName <- map["projectName"] projectDescription <- map["projectDescription"] if isService { companyId <- map["serviceId"] } else { companyId <- map["companyId"] } } }
Currently, I can get Project object as following
let project = Project(JSON: item)
Can I get Project object with initial values like following?
let project = Project(JSON: item, isService: false)
Your model:
What I want
Currently, I can get Project object as following
Can I get Project object with initial values like following?