arrays - Change of syntax -
i used return array of 'mappoints' (from db) using following
extension sequence iterator.element == mappoints { func makejson() -> json { return .array(self.map { $0.makejson() }) } func makeresponse(request: request) throws -> response { return try makejson().makeresponse() } }
this gives error "instance member 'array' cannot used on type 'json'"
can tell me how should done ?
through initialiser json(array: [t])
.
extension sequence iterator.element == post { func makejson() throws -> json { return try json(map { try $0.makejson() }) } func makeresponse(request: request) throws -> response { return try makejson().makeresponse() } }
Comments
Post a Comment