Post

Replies

Boosts

Views

Activity

Comment on can't use @Environment for Binding?
This solution was actually recommended by an Apple engineer during one of the WWDC activities. To add a binding to the @Environment property wrapper would mean adding a projectedValue. If that was something people would like to see (which it is) then they suggested filing a feedback report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Comment on Weird @Binding behavior, doesn't update the value until I set it into different one
It isn't a parameter but the notation for explicitly capturing the specified values from within a closure. Closures are a complex thing in Swift and you can read more in this article and see it in action, like you may have before here: https://www.hackingwithswift.com/articles/179/capture-lists-in-swift-whats-the-difference-between-weak-strong-and-unowned-references.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’23
Comment on Binding with ForEach or List doesn't work anymore when using @Observable macro
This solution was actually recommended by an Apple engineer during one of the WWDC activities. To add a binding to the @Environment property wrapper would mean adding a projectedValue. If that was something people would like to see (which it is) then they suggested filing a feedback report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on can't use @Environment for Binding?
This solution was actually recommended by an Apple engineer during one of the WWDC activities. To add a binding to the @Environment property wrapper would mean adding a projectedValue. If that was something people would like to see (which it is) then they suggested filing a feedback report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Migrating from the Observable Object protocol to the Observable macro
This solution was actually recommended by an Apple engineer during one of the WWDC activities. To add a binding to the @Environment property wrapper would mean adding a projectedValue. If that was something people would like to see (which it is) then they suggested filing a feedback report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Print amount from single member instance on dynamic view
Where do you know how many elements you have? You must have a variable or something that you can use to create the array with that many items and pass to the ForEach.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Print amount from single member instance on dynamic view
Glad I could help. Can you mark an answer as correct to close this thread and so others know your issue has been solved.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on How to form a search predicate using swift data with a one to many model
You're very welcome. It's always nice to help others out and you always learn things along the way. Apple doesn't always know what we developers are thinking which is why feedback is so important. Hopefully, SwiftData gets better because if it's anything like SwiftUI's introduction then a lot of people will be happy. Good luck with your predicates!
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’23
Comment on SwiftData Query relationships not working
Do you mean Xcode 15?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’23
Comment on How to form a search predicate using swift data with a one to many model
You can instead use the localizedLowercase computed property instead, because the lowercased() function isn't allowed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’23
Comment on How to form a search predicate using swift data with a one to many model
Can you make a new post about this as it should really be discussed in the comments of a different post.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’23
Comment on SwiftData crashes the app on iOS Beta 6
The error is happening on iOS 17 beta 6. Xcode 15 beta 6 can build for both beta 5 and 6. So running on the simulator will run for beta 5 where there is no issue. Running on a device on beta 6 will cause the crash.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Comment on SwiftData crashes the app on iOS Beta 6
Xcode 15 beta 6 will only run for an iOS 17 beta 5 simulator. Since there has been no new Xcode release for iOS 17 beta 6, Xcode doesn’t know about this new version. To test for iOS 17 beta 6 you will need a device running it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Comment on NavigationSplitView two and three column interfaces in the same app
I had asked Apple and my solution was based off of someone from the SwiftUI team’s response. So yes, you can switch between different column layouts but it would also be nice to have a better way. My feedback was FB12116429.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Comment on How to use the .onMove SwiftUI modifier to reorder SwiftData elements?
I'm not sure what you're asking. Would you not just use items.sorted { $0.orderIndex < $1.orderIndex } . If that's not the problem, then please add a new reply detailing the issue with proper code snippets.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Comment on Weird @Binding behavior, doesn't update the value until I set it into different one
It isn't a parameter but the notation for explicitly capturing the specified values from within a closure. Closures are a complex thing in Swift and you can read more in this article and see it in action, like you may have before here: https://www.hackingwithswift.com/articles/179/capture-lists-in-swift-whats-the-difference-between-weak-strong-and-unowned-references.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’23
Comment on customized Navigation bar
If that was the answer to your problem, can you please mark that reply as correct to also let others know your issue has been solved.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’23