-
-
Notifications
You must be signed in to change notification settings - Fork 194
/
WhatsNewVersionStore.swift
53 lines (38 loc) · 1.55 KB
/
WhatsNewVersionStore.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
50
51
52
53
import Foundation
// MARK: - WhatsNewVersionStore
/// A WhatsNewVersionStore
public typealias WhatsNewVersionStore = WriteableWhatsNewVersionStore & ReadableWhatsNewVersionStore
// MARK: - WriteableWhatsNewVersionStore
/// A Writeable WhatsNewVersionStore
public protocol WriteableWhatsNewVersionStore {
/// Save presented WhatsNew Version
/// - Parameter version: The presented WhatsNew Version that should be saved
func save(
presentedVersion version: WhatsNew.Version
)
}
// MARK: - ReadableWhatsNewVersionStore
/// A Readable WhatsNewVersionStore
public protocol ReadableWhatsNewVersionStore {
/// The WhatsNew Versions that have been already been presented
var presentedVersions: [WhatsNew.Version] { get }
}
// MARK: - ReadableWhatsNewVersionStore+hasPresented
public extension ReadableWhatsNewVersionStore {
/// Retrieve a bool value if a given WhatsNew Version has already been presented
/// - Parameter whatsNew: The WhatsNew Version to verify
/// - Returns: A Bool value if the given WhatsNew Version has already been preseted
func hasPresented(
_ version: WhatsNew.Version
) -> Bool {
self.presentedVersions.contains(version)
}
/// Retrieve a bool value if a given WhatsNew has already been presented
/// - Parameter whatsNew: The WhatsNew to verify
/// - Returns: A Bool value if the given WhatsNew has already been preseted
func hasPresented(
_ whatsNew: WhatsNew
) -> Bool {
self.hasPresented(whatsNew.version)
}
}