Post

Replies

Boosts

Views

Activity

SwiftUI: AlignmentGuide in Overlay not working when in if block
Scenario A SwiftUI view has an overlay with alignment: .top, the content uses .alignmentGuide(.top) {} to adjust the placement. Issue When the content of the overlay is in an if-block, the alignment guide is not adjusted. Example code The example shows 2 views. Not working example, where the content is an if-block. Working example, where the content is not in an if-block Screenshot: https://github.com/simonnickel/FB15248296-SwiftUIAlignmentGuideInOverlayConditional/blob/main/screenshot.png Tested on - Xcode Version 16.0 RC (16A242) on iOS 18.0 Code // Not working .overlay(alignment: .top) { if true { // This line causes .alignmentGuide() to fail Text("Test") .alignmentGuide(.top, computeValue: { dimension in dimension[.bottom] }) } } // Working .overlay(alignment: .top) { Text("Test") .alignmentGuide(.top, computeValue: { dimension in dimension[.bottom] }) } Also created a Feedback: FB15248296 Example Project is here: https://github.com/simonnickel/FB15248296-SwiftUIAlignmentGuideInOverlayConditional/tree/main
0
1
316
Sep ’24
Swift Package with Demo project with Xcode 16
My current workflow to have a Swift Package with a Demo is like this: PackageFolder > DemoFolder I have a package, with a Demo folder inside. I can open the Demo project and Drag&Drop the local PackageFolder to override the remote dependency with the local one. This allows to edit the package while inside the demo project. With Xcode 16 this does no longer work because Xcode does not allow to drop an ancestor of the file path where the project is located. Xcode does not tell this while you drop, it just does not allow it. But it tells you thats the reason, when you try to add the local package as a dependency to the project: "The selected package cannot be a direct ancestor of the project.". (Dropping other local packages still works, see: https://forums.developer.apple.com/forums/thread/756824) What is the expected way to handle a package with a demo project with Xcode 16?
5
6
1.7k
Jun ’24
NSPersistentCloudKitContainer: Migration failed based on alphabetical order
I added a new Core Data model version, introducing a new entity. Based on the naming of the Entity I get different behaviour: A: If the entity is alphabetically ordered as last entity: Everything works fine. B: There entity is ordered before already existing entities: All records of these existing entities get a new CloudKit id. Resulting in duplicated data and broken relations. In some cases the seem-to-be new insert of these records causes the migration to fail. (Constraint unique violation, reason=constraint violation during attempted migration) My only workaround so far is to just give the entity a different name, to appear last in the list. __ Does anyone else experience this issues? I am not sure if my code could be able to trigger this kind of behaviour. I will try to reproduce it in an empty project, to file a bug report.
4
0
1k
Jun ’20
NSPersistentCloudKitContainer: Migrating multiple devices with data changes in between
What is the expected / best strategy to migrate a synced Core Data model to a new version? The issue: A new app version with a new Core Data model introducing new attributes or entities. DeviceA installs the update and edits data with new values and creates new entities. DeviceB is still used and downloads these changes. The unknown attributes and entities are ignored, but the HistoryTracking gets updated. A few days later DeviceB gets the update. The missing attributes and entities are not downloaded, as the history is up to date. __ The issue exists with iOS 13, I hoped for iOS 14 to introduce a strategy. I tried with the first iOS 14 beta, but it is at least not handled automatically. From the visible API changes I don't see a way to handle this specifically. Not sure if the talks will reveal anything about it. Will apply for a lab session and would like to get as much input to prepare before that might take place.
9
0
2.0k
Jun ’20