Skip to content

Commit

Permalink
fix demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
k-kohey committed Nov 11, 2022
1 parent c8c3594 commit 23b0134
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Demo.swiftpm/Sources/AppModule/Demo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ extension LoggerComponentID {
}

struct MyLogger: LoggerComponent {
static var id: LoggerComponentID = .my
static let id: LoggerComponentID = .my

func send(_ log: [LoggerSendable]) async -> Bool {
print("send \(log)")
try? await Task.sleep(nanoseconds: 1000_000)
return true
}
}
Expand All @@ -36,14 +37,12 @@ struct ExampleAppApp: App {
WindowGroup {
Button("send event") {
Task {
await logger.send(.tap, with: .init(policy: .bufferingFirst))
await logger.send(event: .tap, with: .init(policy: .bufferingFirst))
}
}
.onAppear {
logger.startLogging()
Task {
await logger.send(.impletion("home"))
}
.task {
await logger.startLogging()
await logger.send(event: .impletion("home"))
}
}
}
Expand Down

0 comments on commit 23b0134

Please sign in to comment.