@globalActor public actor Log: GlobalActor {
public static let shared = Log()
let logger = Logger()
}
struct Logger: Sendable {
func log(_ message: String) {
print(message)
}
}
@MainActor
class Foo {
func bar() {
Log.shared.logger.log("Test")
}
}
I would expect to have to call Log.shared.logger.log("Test")
inside a Task
, since I'm accessing my GlobalActor
from the main thread, so it's a different concurrency context. Instead, I get no warnings or errors and it all just works. I have Strict Concurrency Checking set to Complete. What am I misunderstanding?