Settings.swift: ~~consistency~~

This commit is contained in:
James Magahern
2022-08-22 15:44:00 -07:00
parent 58433bc59d
commit ac345ef613

View File

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