Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ObjectMapper
- class network: NSManagedObject, Mappable {
- @NSManaged var localId: NSNumber?
- @NSManaged var version: String?
- @NSManaged var port: String?
- required public init?(map: Map) {
- let ctx = DbHelper .getContext()
- let entity = NSEntityDescription.entity(forEntityName: "network", in: ctx)
- super.init(entity: entity!, insertInto: ctx)
- mapping(map: map)
- }
- public func mapping(map: Map) {
- localId <- map["localId"]
- port <- map["port"] // Returns Int but I want to save it as String
- version <- map["version"] // Returns Int but I want to save it as String
- }
- }
Add Comment
Please, Sign In to add comment