南鑫林 пре 6 година
родитељ
комит
107e9bcec4

+ 13 - 13
RainbowPlanet/Podfile.lock

@@ -1,7 +1,7 @@
 PODS:
   - Alamofire (4.8.2)
   - BaiduMapKit (4.3.2)
-  - BMKLocationKit (1.5.0)
+  - BMKLocationKit (1.6.0)
   - DeviceKit (2.0.0)
   - FMDB (2.7.5):
     - FMDB/standard (= 2.7.5)
@@ -10,7 +10,7 @@ PODS:
   - FWPopupView (4.0.6):
     - SnapKit
   - IQKeyboardManagerSwift (6.3.0)
-  - JXSegmentedView (0.0.11)
+  - JXSegmentedView (0.0.13)
   - KeychainAccess (3.2.0)
   - Kingfisher (4.10.1)
   - LYEmptyView (1.2.3)
@@ -25,18 +25,18 @@ PODS:
   - ObjectMapper (3.4.2)
   - PgyUpdate (1.6)
   - PPBadgeViewSwift (3.1.0)
-  - Realm (3.15.0):
-    - Realm/Headers (= 3.15.0)
-  - Realm/Headers (3.15.0)
-  - RealmSwift (3.15.0):
-    - Realm (= 3.15.0)
+  - Realm (3.16.0):
+    - Realm/Headers (= 3.16.0)
+  - Realm/Headers (3.16.0)
+  - RealmSwift (3.16.0):
+    - Realm (= 3.16.0)
   - Result (4.1.0)
   - RxCocoa (4.5.0):
     - RxSwift (>= 4.4.2, ~> 4.4)
   - RxSwift (4.5.0)
   - SnapKit (4.2.0)
   - SwiftyJSON (5.0.0)
-  - TangramKit (1.3.2)
+  - TangramKit (1.4.0)
   - UMCAnalytics (6.0.3):
     - UMCCommon
   - UMCCommon (2.0.1)
@@ -132,13 +132,13 @@ SPEC REPOS:
 SPEC CHECKSUMS:
   Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
   BaiduMapKit: a5d9580553355d39a91b24c5eb91ebf298c64038
-  BMKLocationKit: 40d267478acd8704ddebd0e9deaddc727b13df9f
+  BMKLocationKit: c8bd4f213b231f743c12c3095ad6a8311db259d8
   DeviceKit: 72d36709552d4b3582abd76a53949148acad9811
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
   FSPagerView: 816a18842306973cc7cc6df8a5332272f7815c30
   FWPopupView: 50e0db3245879b9b73552c897b17a215ac0f9199
   IQKeyboardManagerSwift: a8228c257614af98743b4cd8584637025f36358f
-  JXSegmentedView: cb5f8841f64255ba86c68a8cbab24da72a75b11c
+  JXSegmentedView: adb975e3af18ba9934e9fd3740e536173eb468ab
   KeychainAccess: 3b1bf8a77eb4c6ea1ce9404c292e48f948954c6b
   Kingfisher: c148cd7b47ebde9989f6bc7c27dcaa79d81279a0
   LYEmptyView: ea5827f3f81fcbec427f990005501991477bdae8
@@ -148,14 +148,14 @@ SPEC CHECKSUMS:
   ObjectMapper: 0d4402610f4e468903ae64629eec4784531e5c51
   PgyUpdate: cd6c2ada5928f36a9f904d8f96a9b3b53e190755
   PPBadgeViewSwift: 18a219a9897f418342c22dd1a54f7b18ac56546b
-  Realm: 9b834e1be6062f544805252c812348872dc5d4ed
-  RealmSwift: 8a41886f8ab6efef9eb8df97de2f2bb911561a79
+  Realm: 5ca1b8c472dfc532cd0ba0bfe2ce49f97130158f
+  RealmSwift: 2ee401dbcc188706261921326146f5a539d4d4a7
   Result: bd966fac789cc6c1563440b348ab2598cc24d5c7
   RxCocoa: cbf70265dc65a981d4ac982e513c10cf23df24a0
   RxSwift: f172070dfd1a93d70a9ab97a5a01166206e1c575
   SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
   SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7
-  TangramKit: c844ea1564712698a042907233ee6d7e1dab31a3
+  TangramKit: 15ccb6480f0e32c284f0a076542a607226e158dd
   UMCAnalytics: ff58714ada407682c4a07548156f94bcec92f055
   UMCCommon: 0263a057a2e1ae1da4c8308541e56904a493ce13
   UMCCommonLog: 05a2d5de21858e3d870551562cff405c1366d244

+ 12 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -159,6 +159,7 @@
 		A73911AD229CD62F0033177E /* AlamofireReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73911AC229CD62F0033177E /* AlamofireReachabilityManager.swift */; };
 		A73911B0229E4D970033177E /* PGYManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73911AF229E4D970033177E /* PGYManager.swift */; };
 		A73911B3229ECE340033177E /* UICollectionViewLeftAlignedLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = A73911B1229ECE340033177E /* UICollectionViewLeftAlignedLayout.m */; };
+		A73911B6229EDAC80033177E /* ListTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73911B5229EDAC80033177E /* ListTransform.swift */; };
 		A73D7C682268A032002A4CE3 /* SwiftyStarRatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73D7C672268A032002A4CE3 /* SwiftyStarRatingView.swift */; };
 		A75414FD224B5F28002480B5 /* MobileLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A75414FB224B5F28002480B5 /* MobileLoginViewController.swift */; };
 		A7541502224C5ECB002480B5 /* BaiduMapManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7541501224C5ECA002480B5 /* BaiduMapManager.swift */; };
@@ -549,6 +550,7 @@
 		A73911AF229E4D970033177E /* PGYManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PGYManager.swift; sourceTree = "<group>"; };
 		A73911B1229ECE340033177E /* UICollectionViewLeftAlignedLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UICollectionViewLeftAlignedLayout.m; sourceTree = "<group>"; };
 		A73911B2229ECE340033177E /* UICollectionViewLeftAlignedLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UICollectionViewLeftAlignedLayout.h; sourceTree = "<group>"; };
+		A73911B5229EDAC80033177E /* ListTransform.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTransform.swift; sourceTree = "<group>"; };
 		A73D7C672268A032002A4CE3 /* SwiftyStarRatingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftyStarRatingView.swift; sourceTree = "<group>"; };
 		A75414FB224B5F28002480B5 /* MobileLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileLoginViewController.swift; sourceTree = "<group>"; };
 		A7541501224C5ECA002480B5 /* BaiduMapManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaiduMapManager.swift; sourceTree = "<group>"; };
@@ -1733,6 +1735,14 @@
 			path = PGYManager;
 			sourceTree = "<group>";
 		};
+		A73911B4229EDABB0033177E /* ListTransform */ = {
+			isa = PBXGroup;
+			children = (
+				A73911B5229EDAC80033177E /* ListTransform.swift */,
+			);
+			path = ListTransform;
+			sourceTree = "<group>";
+		};
 		A73D7C662268A032002A4CE3 /* SwiftyStarRatingView */ = {
 			isa = PBXGroup;
 			children = (
@@ -2187,6 +2197,7 @@
 		A77F2CBC2232022A001BD3F6 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
+				A73911B4229EDABB0033177E /* ListTransform */,
 				A7146346228EFCE20066099B /* SKUDataFilter */,
 				A7274C51228EE635000E3A07 /* SwiftScan */,
 				A7274C4E228EE5EF000E3A07 /* PhotoAndCameraManager */,
@@ -3452,6 +3463,7 @@
 				A719016B22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift in Sources */,
 				A729B5B72267270B004AE098 /* PasswordLoginView.swift in Sources */,
 				A7778CB82244E97A00C7C47A /* BindPhoneNumberViewController.swift in Sources */,
+				A73911B6229EDAC80033177E /* ListTransform.swift in Sources */,
 				A754150F224CACF9002480B5 /* SwiftSign.swift in Sources */,
 				A72A72D322321E2700B21995 /* CacheMacro.swift in Sources */,
 				A71AF0BA226F00F8001730FE /* SearchResultView.swift in Sources */,

+ 1 - 2
RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSModel.swift

@@ -2,10 +2,9 @@
 //	CMSModel.swift
 //	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
 
-import Foundation 
+import Foundation
 import ObjectMapper
 
-
 class CMSModel : NSObject, NSCoding, Mappable{
 
 	var applyType : String?

+ 39 - 0
RainbowPlanet/RainbowPlanet/Tools/ListTransform/ListTransform.swift

@@ -0,0 +1,39 @@
+//
+//  ListTransform.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/5/29.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import RealmSwift
+import ObjectMapper
+
+class ListTransform<T:RealmSwift.Object> : TransformType where T:Mappable {
+    typealias Object = List<T>
+    typealias JSON = [AnyObject]
+    
+    let mapper = Mapper<T>()
+    
+    func transformFromJSON(_ value: Any?) -> Object? {
+        let results = List<T>()
+        if let objects = mapper.mapArray(JSONObject: value) {
+            for object in objects {
+                results.append(object)
+            }
+        }
+        return results
+    }
+    
+    func transformToJSON(_ value: Object?) -> JSON? {
+        var results = [AnyObject]()
+        if let value = value {
+            for obj in value {
+                let json = mapper.toJSON(obj)
+                results.append(json as AnyObject)
+            }
+        }
+        return results
+    }
+}