-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f214a6
commit e7ea96a
Showing
32 changed files
with
874 additions
and
344 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import SwiftUI | ||
|
||
protocol Event {} | ||
|
||
struct ErrorEvent: Event { | ||
let error: UnexpectedError | ||
|
||
init(_ error: UnexpectedError) { | ||
self.error = error | ||
} | ||
} | ||
|
||
extension Event { | ||
typealias error = ErrorEvent | ||
} | ||
|
||
struct FailureEvent: Event { | ||
let title: LocalizedStringKey | ||
let text: LocalizedStringKey | ||
} | ||
|
||
extension Event { | ||
typealias failure = FailureEvent | ||
} | ||
|
||
struct NavigationShortcutEvent: Event { | ||
let destination: Destination | ||
|
||
init(to destination: Destination) { | ||
self.destination = destination | ||
} | ||
} | ||
|
||
extension Event { | ||
typealias navigationShortcut = NavigationShortcutEvent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Combine | ||
import SwiftUI | ||
|
||
class EventBus: ObservableObject { | ||
private let subject = PassthroughSubject<Event, Never>() | ||
|
||
let events: AnyPublisher<Event, Never> | ||
|
||
init() { | ||
events = subject.eraseToAnyPublisher() | ||
} | ||
|
||
@MainActor | ||
func send(_ event: Event) { | ||
subject.send(event) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.