« first day (6 days earlier)    last day (15 days later) » 

12:04
Thank you so much for detailed examples @Rob. What I meant to say with my message "I can see that execution is not concurrent but parallel" was instead "I can see that execution is not concurrent but serial"
```
```
let poi = OSLog(subsystem: "Test", category: .pointsOfInterest)

class DummyVC: ObservableObject {}

struct ContentView: View {
    @ObservedObject var dummy = DummyVC()

    var body: some View {
        VStack {
            Button("Launch Ten Tasks") {
                launchTenTasks()
            }
        }
        .padding()
    }

    func launchTenTasks() {
        let experiment = Experiment()

        for i in 0 ..< 10 {
            Task {
                experiment.spin(index: i, for: 1)
The code above will result in serial execution of the tasks, and the only difference is the presence of a @ObjservedObject in the view which is not used.
12:30
Oh well, I think I managed to answer my question. The fact that we have @ObservedObject in a view means that the view will be implicitly isolated to the MainActor due to "A struct or class containing a wrapped instance property with a global actor-qualified wrappedValue infers actor isolation from that property wrapper:
" from: https://github.com/apple/swift-evolution/blob/main/proposals/0316-global-actors.md
 
7 hours later…
Rob
Rob
19:47
@Petar – Agreed. Adding the @ObservedObject property to the View ends up actor-isolating the whole ContentView, and thus launchTenTasks is suddenly isolated to the main actor. And now that launchTenTasks is actor-isolated, then Task {…} will create top-level tasks on behalf of the main actor, which will prevent parallel execution.
The moral of the story is that if you want parallel execution, it is not prudent to use Task {…} and rely upon the fact that you just happened to be calling it from a function that is in a type that is not actor isolated. Either explicitly make launchTenTasks a nonisolated function, or use Task.detached {…}, or a task group, or async let.

« first day (6 days earlier)    last day (15 days later) »