|
@@ -4,51 +4,39 @@
|
|
|
|
|
|
import Foundation
|
|
import Foundation
|
|
import ObjectMapper
|
|
import ObjectMapper
|
|
|
|
+import Realm
|
|
|
|
+import RealmSwift
|
|
|
|
|
|
|
|
|
|
-class CMSTemplateModel : NSObject, NSCoding, Mappable{
|
|
|
|
-
|
|
|
|
- var applyType : Int?
|
|
|
|
- var title : String?
|
|
|
|
|
|
+class CMSTemplateModel : Object, Mappable{
|
|
|
|
|
|
|
|
+ dynamic var applyType : Int?
|
|
|
|
+ dynamic var title : String?
|
|
|
|
|
|
class func newInstance(map: Map) -> Mappable?{
|
|
class func newInstance(map: Map) -> Mappable?{
|
|
- return CMSTemplateModel()
|
|
|
|
- }
|
|
|
|
- required init?(map: Map){}
|
|
|
|
- private override init(){}
|
|
|
|
-
|
|
|
|
- func mapping(map: Map)
|
|
|
|
- {
|
|
|
|
- applyType <- map["apply_type"]
|
|
|
|
- title <- map["title"]
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * NSCoding required initializer.
|
|
|
|
- * Fills the data from the passed decoder
|
|
|
|
- */
|
|
|
|
- @objc required init(coder aDecoder: NSCoder)
|
|
|
|
- {
|
|
|
|
- applyType = aDecoder.decodeObject(forKey: "apply_type") as? Int
|
|
|
|
- title = aDecoder.decodeObject(forKey: "title") as? String
|
|
|
|
-
|
|
|
|
|
|
+ return CMSTemplateModel(map: map)
|
|
}
|
|
}
|
|
-
|
|
|
|
- /**
|
|
|
|
- * NSCoding required method.
|
|
|
|
- * Encodes mode properties into the decoder
|
|
|
|
- */
|
|
|
|
- @objc func encode(with aCoder: NSCoder)
|
|
|
|
- {
|
|
|
|
- if applyType != nil{
|
|
|
|
- aCoder.encode(applyType, forKey: "apply_type")
|
|
|
|
- }
|
|
|
|
- if title != nil{
|
|
|
|
- aCoder.encode(title, forKey: "title")
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+ required convenience init?(map: Map){
|
|
|
|
+ self.init()
|
|
|
|
+// mapping(map: map)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func mapping(map: Map)
|
|
|
|
+ {
|
|
|
|
+ applyType <- map["apply_type"]
|
|
|
|
+ title <- map["title"]
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ required init() {
|
|
|
|
+ super.init()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
|
|
|
+ fatalError("init(realm:schema:) has not been implemented")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ required init(value: Any, schema: RLMSchema) {
|
|
|
|
+ fatalError("init(value:schema:) has not been implemented")
|
|
|
|
+ }
|
|
|
|
+}
|