Avatar
struct Client { var handler: @Sendable () async throws -> Void static let shared: Client = { let model = Model() return Self(handler: { try await trampoline(model: model) }) }() actor Model { func handle() throws {} } } func trampoline(model: Client.Model) async throws { try await model.handle() }
2:31 PM
これで両方で警告なしにできました。素晴らしい
2:32 PM
トップレベルにtrampoline funcがあるのがちょっと🤔ですがenumでネームスペース作るとかかなぁ