[ADD] option to duplicate server profile on preference

This commit is contained in:
Rizwan
2017-01-05 18:26:33 +08:00
parent cc342df5b5
commit 35d764fe2a
3 changed files with 43 additions and 4 deletions

View File

@ -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