Relative Content

Tag Archive for swiftui

How to navigate through a questionnaire?

currently I’m struggeling in tinding a solution. I have a main view which loops over CoreData records for questionnaires and displays them in a list within a NavigationStack. Then I have a view that displays a single question of a questionnaire. How would I now handle the navigation through my questions in a choosen questionnaire because my subview is only accepting a single question and I need somewhere to keep track on the status of the current questionnaire.

SwiftUI 3rd level of .sheet() disappears immediately

In MacCatalyst on MacOS Sonoma 14.6 when my app has 3 levels of active sheets the 3rd sheet disappears immediately after presenting, if the 1st level sheet is a modifier on a view in the NavigationStack, rather than a modifier of the NavigationStack. I don’t have this problem in MacCatalyst on MacOS 13.6, on iOS 16.4 or on iOS 17.6. In my real app each one of these NavigationStacks has many sheets, hence the use of the overlays. What’s the right way to make this work on iOS > 16 and macCatalyst on MacOs > 14.6? Thank you

SwiftUI Toggle stops responding after returning from background

Having a weird bug. I am running a beta of ios18.1 btw.. so maybe that’s the issue. I have a few toggle controls on a .medium height share sheet. They work well. If I background the app, and then foreground, one of the toggles stops responding (the bottoms most one in the vstack). Well.. if I tap several times sometimes it works, but certainly not well. Has anyone encountered this?

SwiftUI Publishing changes from background threads is not allowed

@MainActor class MortgageCalculatorViewModel: ObservableObject { // MARK: – Published Properties (Your Data Model) @Published public var homeValue: Double = 500_000 // Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates. @Published public var downPaymentPercentage: Double = 3.5 / 100 @Published […]