-
Notifications
You must be signed in to change notification settings - Fork 0
/
Newsletter+Defaults.swift
49 lines (43 loc) · 1.01 KB
/
Newsletter+Defaults.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// Newsletter+Defaults.swift
// Swift Weekly Brief
//
// Created by Jeroen Leenarts on 22/03/2021.
//
import Foundation
enum DefaultsError: Error {
case defaultsSuiteMissing
case malformedUrl
case missingValue
}
extension UserDefaults {
private enum DefaultsKey: String {
case rssFeed
case contentUrl
case apiCampaignUrl
}
var rssFeed: String? {
get {
string(forKey: DefaultsKey.rssFeed.rawValue)
}
set {
set(newValue, forKey: DefaultsKey.rssFeed.rawValue)
}
}
var contentUrl: String? {
get {
string(forKey: DefaultsKey.contentUrl.rawValue)
}
set {
set(newValue, forKey: DefaultsKey.contentUrl.rawValue)
}
}
var apiCampaignUrl: String? {
get {
string(forKey: DefaultsKey.apiCampaignUrl.rawValue)
}
set {
set(newValue, forKey: DefaultsKey.apiCampaignUrl.rawValue)
}
}
}