Post

Replies

Boosts

Views

Activity

Reply to Not expected result when changing a variable in a "defer" block, if the variable has observers willSet or didSet.
I changed by adding a statement in willSet: func foo() { var i = 0 { willSet { print("willSet", i) } } defer { i -= 1 print("defer", i) // expected result - 2, prints - 3 } i = 3 } foo() And get the expected result willSet 0 willSet 3 defer 2 I instrumented more: func foo() { var i = 0 { willSet { print("willSet, i is still", i) } } defer { i -= 1 print("defer", i) // expected result - 2, prints - 3 } print("soon i = 3, now is", i) i = 3 print("now i = 3", i) } foo() And get: soon i = 3, now is 0 willSet, i is still 0 now i = 3 3 willSet, i is still 3 defer 2 I remove the call to i in willSet:     willSet { print("willSet") } // , i is still", i) } And get: soon i = 3, now is 0 willSet now i = 3 3 willSet defer 3
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to Not expected result when changing a variable in a "defer" block, if the variable has observers willSet or didSet.
I tracked in debugger and I observe that willSet does not update i: func foo() { var i = 0 { willSet { print("willSet") } } defer { i -= 1 print("defer", i) // expected result - 2, prints - 3 } print("soon i = 3, now is", i) i = 3 print("now i = 3", i) } foo() Here is the sequence and values in console: Statement                     value in console var i = 0 print("Soon")             i = 0 i = 3                            value = 3 willSet                        newValue = 3 print("now")              i = 3 defer i -= 1 willSet                        value = 2 willSet                        newValue = 2 // newValue is correctly passed willSet                        i = 3 // after executing willSet, i is NOT updated to newValue : that's the bug
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to Cannot find 'Table' in scope
This app can run only on MacOS 12. struct like KeyPathComparator, Table and others are not available before. Hence the error messages you get with 11.6. If I were you, I would wait for official release of MacOS 12 and not try to install beta version.
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’21
Reply to DocC exclude
If you don't add the /// line above the preview struct, it shouldn't appear in doc. Am I missing something ?
Replies
Boosts
Views
Activity
Oct ’21
Reply to Can I display an Alert from a context menu?
You need to call the alert outside of the toolbar. This example should help: https://stackoverflow.com/questions/65433858/swiftui-show-alert-from-button-inside-of-toolbaritem
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Not expected result when changing a variable in a "defer" block, if the variable has observers willSet or didSet.
I changed by adding a statement in willSet: func foo() { var i = 0 { willSet { print("willSet", i) } } defer { i -= 1 print("defer", i) // expected result - 2, prints - 3 } i = 3 } foo() And get the expected result willSet 0 willSet 3 defer 2 I instrumented more: func foo() { var i = 0 { willSet { print("willSet, i is still", i) } } defer { i -= 1 print("defer", i) // expected result - 2, prints - 3 } print("soon i = 3, now is", i) i = 3 print("now i = 3", i) } foo() And get: soon i = 3, now is 0 willSet, i is still 0 now i = 3 3 willSet, i is still 3 defer 2 I remove the call to i in willSet:     willSet { print("willSet") } // , i is still", i) } And get: soon i = 3, now is 0 willSet now i = 3 3 willSet defer 3
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Not expected result when changing a variable in a "defer" block, if the variable has observers willSet or didSet.
Effectively, exact same problem with didSet.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to How to make good User Interfaces
You should also show the full code so that one can analyse.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Cant search my app on app store
Your post is hard to understand ; it seems there are missing words. How long ago did you post your app ? It could take some time before it appears (1 day).
Replies
Boosts
Views
Activity
Oct ’21
Reply to mechanical controls
It is "forbidden" to change the function of those buttons. Your app will probably be rejected if you do so.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to iPhone 13 pro Apple CarPlay crashing as soon as music plays (Apple Music)
Apparently they fixed a bug for Audio in CarPlay in 15.0.2 According to Apple: This update includes bug fixes for your iPhone: Photos saved to your library from Messages could be deleted after removing the associated thread or message CarPlay may fail to open audio apps or disconnect during playback
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Submit for review
Did you contact them as suggested ? You may have an account issue.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Hi! We have found a lib crash, only in iOS 15, It affects a large group of our users. Is it a known issue? How can we fix it? Thanks!
What is TruckLoads ? Is it an object of yours ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Not expected result when changing a variable in a "defer" block, if the variable has observers willSet or didSet.
I tracked in debugger and I observe that willSet does not update i: func foo() { var i = 0 { willSet { print("willSet") } } defer { i -= 1 print("defer", i) // expected result - 2, prints - 3 } print("soon i = 3, now is", i) i = 3 print("now i = 3", i) } foo() Here is the sequence and values in console: Statement                     value in console var i = 0 print("Soon")             i = 0 i = 3                            value = 3 willSet                        newValue = 3 print("now")              i = 3 defer i -= 1 willSet                        value = 2 willSet                        newValue = 2 // newValue is correctly passed willSet                        i = 3 // after executing willSet, i is NOT updated to newValue : that's the bug
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Cannot find 'Table' in scope
In the "GardenDetail" view in the "Navigation" Folder of the project Xcode Which project ? That would really help if you provided the exact access link to the code.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Rebrand application
Do you want to change the App ID or only the app name. AFAIK, no problem to change the app name. But if you change AppID, that will be a new app and you will probably have to remove the old one.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Ask for app feedback as an intermediate step before app review
That would be a way to fool the rating system by forbidding negative comments. That's not allowed (and could even put your account at risk).
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Cannot find 'Table' in scope
This app can run only on MacOS 12. struct like KeyPathComparator, Table and others are not available before. Hence the error messages you get with 11.6. If I were you, I would wait for official release of MacOS 12 and not try to install beta version.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21