Settings.swift: ~~consistency~~
This commit is contained in:
@@ -43,6 +43,22 @@ extension Dictionary: RawRepresentable where Key == String, Value == String {
|
||||
}
|
||||
}
|
||||
|
||||
extension Optional: RawRepresentable where Wrapped == String {
|
||||
public typealias RawValue = String?
|
||||
|
||||
public init?(rawValue: String?) {
|
||||
if let rawValue {
|
||||
self = String(rawValue: rawValue)
|
||||
} else {
|
||||
self = .none
|
||||
}
|
||||
}
|
||||
|
||||
public var rawValue: String? {
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
extension String: RawRepresentable {
|
||||
public typealias RawValue = String
|
||||
|
||||
@@ -109,20 +125,3 @@ class Settings
|
||||
@SettingProperty(key: "syncServer")
|
||||
public var syncServer: Optional<String> = "https://attractor.severnaya.net"
|
||||
}
|
||||
|
||||
extension Optional: RawRepresentable where Wrapped == String
|
||||
{
|
||||
public init?(rawValue: String?) {
|
||||
if let rawValue {
|
||||
self = String(rawValue: rawValue)
|
||||
} else {
|
||||
self = .none
|
||||
}
|
||||
}
|
||||
|
||||
public var rawValue: String? {
|
||||
return self
|
||||
}
|
||||
|
||||
public typealias RawValue = String?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user