Protocolized

This commit is contained in:
Max Goedjen
2020-03-15 00:32:56 -07:00
parent 979e5b3e3c
commit 5a75e5440f
4 changed files with 53 additions and 30 deletions

View File

@@ -1,6 +1,27 @@
import Foundation
import Combine
class PreviewUpdater: ObservableObject, UpdaterProtocol {
var update: Release? = nil
class PreviewUpdater: UpdaterProtocol {
let update: Release?
init(update: Update = .none) {
switch update {
case .none:
self.update = nil
case .advisory:
self.update = Release(name: "10.10.10", html_url: URL(string: "https://example.com")!, body: "Some regular update")
case .critical:
self.update = Release(name: "10.10.10", html_url: URL(string: "https://example.com")!, body: "Critical Security Update")
}
}
}
extension PreviewUpdater {
enum Update {
case none, advisory, critical
}
}