diff --git a/App/Settings/Settings.swift b/App/Settings/Settings.swift index a4469fb..c0983e8 100644 --- a/App/Settings/Settings.swift +++ b/App/Settings/Settings.swift @@ -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 = "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? -}