Hi everyone, I'm new to Xcode and iOS development. I've encountered an issue where asynchronous tasks seem to not execute in Xcode Canvas, but they work fine in the simulator. Can anyone explain why this might be happening or what I could do to fix it? Thank you for your help!
struct PartnerProfileView: View {
@State private var showSheet: Bool = true
let partnerName: String
var body: some View {
ZStack(alignment: .bottom) {
Color("EFEFF4_0F2534")
ScrollView(showsIndicators: false) {
headerSection()
infoSection()
.padding(.bottom, 5)
sectionTitle("Other Skills")
skillsGrid()
sectionTitle("···")
dynamicsSection()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
CustomTabBar()
}
.navigationBarHidden(true)
.ignoresSafeArea(edges: .all)
.onAppear {
print("PartnerProfileView received")
Task {
await BottomCustomPopup().present()
}
}
.onChange(of: showSheet) { oldState, newValue in
print("oldState \(oldState)")
print("newValue \(newValue)")
}
}
}
//@MainActor
struct BottomCustomPopup: BottomPopup {
var body: some View {
HStack(spacing: 0) {
Text("Hello World")
Spacer()
Button(action: { Task { await dismissLastPopup() }}) { Text("Dismiss") }
}
.padding(.vertical, 20)
.padding(.leading, 24)
.padding(.trailing, 16)
}
}