Guest User

Untitled

a guest
Apr 27th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import ObjectMapper
  2. class network: NSManagedObject, Mappable {
  3. @NSManaged var localId: NSNumber?
  4. @NSManaged var version: String?
  5. @NSManaged var port: String?
  6.  
  7. required public init?(map: Map) {
  8. let ctx = DbHelper .getContext()
  9. let entity = NSEntityDescription.entity(forEntityName: "network", in: ctx)
  10. super.init(entity: entity!, insertInto: ctx)
  11.  
  12. mapping(map: map)
  13. }
  14.  
  15. public func mapping(map: Map) {
  16. localId <- map["localId"]
  17. port <- map["port"] // Returns Int but I want to save it as String
  18. version <- map["version"] // Returns Int but I want to save it as String
  19. }
  20. }
Add Comment
Please, Sign In to add comment