南鑫林 před 6 roky
rodič
revize
d2d456a6d4

binární
.DS_Store


+ 30 - 42
RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSTemplateModel.swift

@@ -4,51 +4,39 @@
 
 import Foundation 
 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?{
-		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")
+    }
+}

+ 3 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift

@@ -10,6 +10,9 @@ import UIKit
 import Moya
 import SwiftyJSON
 import ObjectMapper
+import Realm
+import RealmSwift
+
 
 class SwiftMoyaNetWorkServiceCMS: NSObject {
     private static let _sharedInstance = SwiftMoyaNetWorkServiceCMS()