Calling a @MainActor function in main.swift gives an error
Swift Forums
Calling a @MainActor function in main.swift gives an error
I'm learning about @MainActor using a command-line app. This code gives me an error: @MainActor func show(photo: String) { // Display photo on the UI print("Displaying \(photo)") } show(photo: "cat") Error: Call to main actor-isolated global function 'show(photo:)' in a synchronous nonisolated context My project is old, but running the same code in a new command-line app gives the same error. I thought that all code in a command-line app ran in the main actor, so I expected the call ...
0 comments
No comments yet.