Post

Replies

Boosts

Views

Activity

Comment on Limit width of wheel style picker on iOS
As the Xcode and iOS release notes mentioned very few SwiftUI related change, I didn't try them because I don't think it's worth the trouble. I ended up with a SwiftUI + UIKit hybrid approach (unfortunately the forum doesn't allow me to post the link). I can't believe, for a serious regression like this, the SwiftUI team in Apple just keep silent and pretend nothing happened. They could respond with a simple UIKit based workaround to save a LOT of people's time. What a shame!
Feb ’22
Comment on Xcode 14: Publishing changes from within view updates
One more thing. When I wrote the above I assumed the error occurred for all Views that wrote to its binding param. My further experiments show that's not true. For example, TextField doesn't have this issue. So it seems only some Views (e.g. Picker, Sheet) have this issue. We need an official answer from the SwiftUI team on what exactly the error message means. Before that I'll continue to use my solution above.
Aug ’22
Comment on Xcode 14: Publishing changes from within view updates
I realized a much better approach to work around the issue (or feature). The new approach is to use DispatchQueue.main.async() to decouple the simultaneous change. The elegant part is that we can write a generic function to take the original binding and return a new custom binding, and encapsulate the async() call in the new binding's getter. Unfortunately I can't post the code in comment, but it's very simple to implement it.
Sep ’22
Comment on iOS app on Apple Silicon Mac: how are app data files protected?
Thanks for the information. Embedding a fixed decryption key is what I do. My app supports user send data to another phone using airdrop, and I encrypts the file when transferring it. However I don't encrypt data files on phones yet. BTW, in my app the data are owned by user, so it's fine if they take a screenshot or do whatever. My purpose is to prevent other people to look at the data.
Feb ’23