I'm sure you're heard of this before, but I had a parser in Obj-C for mapping values from a JSON dictionary to an Obj-C class using class_copyPropertyList.
Unfortunately this is not compatible with swift. So if i wanted to implement the same code I need to provide a bridging header and ensure that the swift objects are subclasses of NSObjects. It's also not very compatible since it does not support mappings for Enums, Structs or Generic Swift Classes.
Win yourselves the heart of the developer community by providing a framework feature for mapping properties directly into any swift class, enum or struct by providing a groundbreaking mapping function! Something flexible that allows developer some control. I was thinking of something along the lines of:
WHERE:
class SwiftObject {
var variableX : Int?
}AND:
func getJsonDictionary() -> [String:AnyObject]{
return { "variableX" : 100 }
}THEN:
let json : [String:AnyObject] = self.getJsonDictionary()
print(swiftObject.variableX) //prints nil
swiftObject.map({ (variableName: String) -> AnyObject? in
return json[variableName]
})
print(swiftObject.variableX) //prints 100I think a new feature like this would make anyone's day! 🙂