Post

Replies

Boosts

Views

Activity

UICollectionViewCompositionalLayout set Header via Configuration leads to Crash
I am trying to use UICollectionViewCompositionalLayout and would like to add a sticky global header to the whole collection view. As far as I understand the documentation, this can be done via the UICollectionViewCompositionalLayoutConfiguration by adding a boundarySupplementaryItem and by setting pinToVisibleBounds to true. I tried this and used the following layout: let layout = UICollectionViewCompositionalLayout.list( using: .init(appearance: .plain) ) let supplementary = NSCollectionLayoutBoundarySupplementaryItem(     layoutSize: .init( widthDimension: .fractionalWidth(1), heightDimension: .absolute(50) ),         elementKind: UICollectionView.elementKindSectionHeader,         alignment: .top ) let configuration = UICollectionViewCompositionalLayoutConfiguration()     supplementary.pinToVisibleBounds = true     configuration.boundarySupplementaryItems = [supplementary]     layout.configuration = configuration This works just fine, but if there are no items in the collection view and I scroll the content (and especially the global header) out of the viewport, I encounter a weird crash which I am not sure how to fix or if I can fix it. The crash is: 2022-06-13 14:20:57.001033+0200 CompositonalLayoutGlobalHeaderCrash[79529:2256455] *** Assertion failure in CGRect _UIPinnedFrameForFrameWithContainerFrameVisibleFrame(CGRect, CGRect, CGRect, NSRectAlignment)(), _UICollectionLayoutHelpers.m:733 2022-06-13 14:20:57.012169+0200 CompositonalLayoutGlobalHeaderCrash[79529:2256455] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Frame {{0, 50}, {375, 0}} does not intersect {{0, 50}, {375, 0}}' For me it seems like there is a assertion in the layout which checks that the global header does not leave the frame of the collection views content. Is this a bug of UICompositionalLayout or is there someone who can help fixing this?
2
0
1k
Jun ’22
Simulate background push notification (Xcode 12 release notes)
The release notes of Xcode 12 beta 1 states When simulating a push notification in Simulator with the content-available key set, the system now calls application(:performFetchWithCompletionHandler:) instead of application(:didReceiveRemoteNotification:fetchCompletionHandler:). (60426170) (FB7625283) The problem is, in Xcode 11 the system did already call performFetchWithCompletionHandler, which I think is a bug and was also filed in FB7625283. If I test this on a real device, the system calls didReceiveRemoteNotification, which is the right method, at least from my understanding. Now to my question, should the system really call performFetchWithCompletionHandler or are the release notes wrong and the issue isn't fixed?
3
0
2.4k
Jul ’20