[ADD] option to duplicate server profile on preference
This commit is contained in:
@ -10,7 +10,8 @@ import Cocoa
|
||||
|
||||
|
||||
|
||||
class ServerProfile: NSObject {
|
||||
class ServerProfile: NSObject, NSCopying {
|
||||
|
||||
var uuid: String
|
||||
|
||||
var serverHost: String = ""
|
||||
@ -28,6 +29,17 @@ class ServerProfile: NSObject {
|
||||
self.uuid = uuid
|
||||
}
|
||||
|
||||
public func copy(with zone: NSZone? = nil) -> Any {
|
||||
let copy = ServerProfile()
|
||||
copy.serverHost = self.serverHost
|
||||
copy.serverPort = self.serverPort
|
||||
copy.method = self.method
|
||||
copy.password = self.password
|
||||
copy.remark = self.remark
|
||||
copy.ota = self.ota
|
||||
return copy;
|
||||
}
|
||||
|
||||
static func fromDictionary(_ data:[String:AnyObject]) -> ServerProfile {
|
||||
let cp = {
|
||||
(profile: ServerProfile) in
|
||||
|
Reference in New Issue
Block a user