Issue
The .task modifier on views seems not to fire.
Tested Environment
The test has been conducted on
- Ubuntu Server 24.04 LTS with Swift toolchain version 6.3.2
- macOS Sequoia 15.7.7 with Swift toolchain version 6.2.4.1.4
and TUIKit main branch version.
How to Reproduce
import TUIkit
struct ContentView: View {
@State private var taskHasRun = false
var body: some View {
VStack {
Text("Hello, TUIkit!")
.foregroundStyle(.palette.accent)
.bold()
.task { await flagTaskAsRun() }
Text("Welcome to your new terminal app")
.foregroundStyle(.palette.foregroundSecondary)
.task { await flagTaskAsRun() }
Spacer()
Text(".task has \(taskHasRun == true ? "indeed":"not") run")
.task { await flagTaskAsRun() }
}
.padding()
.task { await flagTaskAsRun() }
}
func flagTaskAsRun() async {
taskHasRun = true
}
}
Observed Behaviour
The following simple test program shows that taskHasRun will never ever be set to true, so the last Text view will display .task has not run.
Expected Behaviour
With either VStack or any of the Text views the function flagTaskAsRun() should be fired and hence taskHasRun should be set to true, so the last Text view should display .task has indeed run.
Issue
The
.taskmodifier on views seems not to fire.Tested Environment
The test has been conducted on
and TUIKit main branch version.
How to Reproduce
Observed Behaviour
The following simple test program shows that
taskHasRunwill never ever be set totrue, so the lastTextview will display.task has not run.Expected Behaviour
With either
VStackor any of theTextviews the functionflagTaskAsRun()should be fired and hencetaskHasRunshould be set totrue, so the lastTextview should display.task has indeed run.