Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- import ObjectMapper
- class LocationModel: Mappable{
- init(latitude: Double = 0.0,longitude: Double = 0.0,timestamp:NSDate = NSDate()){
- self._latitude = latitude
- self._longitude = longitude
- self._timestamp = timestamp
- }
- required init?(_ map: Map) {
- }
- func mapping(map: Map) {
- if map.mappingType == .ToJSON{
- self._latitude <- map["latitude"]
- self._longitude <- map["longitude"]
- self._timestamp <- map["timestamp"]
- }
- }
- var _latitude: Double?
- var _longitude: Double?
- var _timestamp: NSDate?
- }
- var location = LocationModel(42.9837, -81.2497,NSDate())
- let JSONString = Mapper().toJSON(npForm)
- print(JSONString)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement