第三天 moyax
struct Blog { static let BaseURL = NSURL(string: "http://192.168.1.103/blog")! } extension Blog { struct Events { static let Path = "events" } } extension Blog.Events { struct Listing:LLTarget { init() { } let baseURL = Blog.BaseURL let path = Blog.Events.Path var parameters: [String: AnyObject] { var parameters = [String: AnyObject]() return parameters } typealias DeserializedType = [Event] func parseResponse(json: JSON) -> DeserializedType? { var topics = DeserializedType(byJSON:json["events"]) return topics; } } }
struct Event: CustomDebugStringConvertible,SwiftyJSONMappable { let title:String let feeltitle:String let address:String // let day:String // let month:String var imgs:[String]? init?(byJSON json: JSON) { if json.type == .Null { return nil } self.title = json["title"].stringValue self.feeltitle = json["feeltitle"].stringValue self.address = json["address"].stringValue } }