Ver Fonte

支持 copy 协议

jsonwang há 3 anos atrás
pai
commit
3867175e1d

+ 7 - 1
BFFramework/Classes/PModels/editDarftModels/PQEditBaseModel.swift

@@ -41,7 +41,7 @@ public let sectionIndexTransform = TransformOf<Int, Int>(fromJSON: { (value: Int
     return nil
 })
 
-open class PQEditBaseModel: Object, Mappable {
+open class PQEditBaseModel: Object, Mappable ,NSCopying{
     @objc dynamic public var uniqueId: String = getUniqueId(desc: "uniqueId")
     public func mapping(map _: Map) {}
 
@@ -52,4 +52,10 @@ open class PQEditBaseModel: Object, Mappable {
     override required public init() {
         super.init()
     }
+    
+    public func copy(with zone: NSZone? = nil) -> Any {
+            let editBaseModel = PQEditBaseModel()
+            editBaseModel.uniqueId = uniqueId
+            return editBaseModel
+        }
 }

+ 30 - 0
BFFramework/Classes/PModels/editDarftModels/PQEditVisionTrackMaterialsModel.swift

@@ -278,4 +278,34 @@ public class PQEditVisionTrackMaterialsModel: PQEditBaseModel {
             }
         }
     }
+    public override func copy(with zone: NSZone? = nil) -> Any {
+        let temp = PQEditVisionTrackMaterialsModel.init()
+       
+        temp.width = width
+        
+        temp.height = height
+        temp.itemWidth = itemWidth
+        temp.itemHeight = itemHeight
+        temp.sourceType = sourceType
+        temp.type = type
+        temp.canvasFillType = canvasFillType
+        temp.materialType = materialType
+        temp.duration = duration
+        temp.aptDuration = aptDuration
+        temp.id = id
+        temp.materialLayer = materialLayer
+        temp.materialEffect = materialEffect
+        temp.timelineIn = timelineIn
+        temp.timelineOut = timelineOut
+        temp.model_in = model_in
+        temp.out = out
+        temp.speedRate = speedRate
+        temp.volumeGain = volumeGain
+        temp.materialUrl = materialUrl
+        temp.netResUrl = netResUrl
+        temp.netResCoverImageURL = netResCoverImageURL
+        temp.locationPath = locationPath
+ 
+        return temp
+    }
 }