Post

Replies

Boosts

Views

Activity

UICollectionViewCompositionalLayout + paging + rotation == not handled correctly
Am trying to get away from using UIPageViewController for a number of reasons, not the least of which is several perennial crashes that happen occasionally that I've never been able to reproduce myself but happen enough in the wild to be noticeable. I have high hopes for the new UICollectionViewCompositionalLayout in iOS 13 SDK; have worked around the safeArea issue. However, I cannot find a way to workaround or fix the problem that occurs when I rotate the device. Before rotation things are great, paging works, etc. Then when I do rotate the device the collectionView is scrolled such that I see half of two separate cells. Basically the current cell is not handled correctly. Any ideas or suggestions? Below is my layout for reference. Its as basic as one can get.     private func createLayout() -> UICollectionViewLayout {         let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))         let item = NSCollectionLayoutItem(layoutSize: itemSize)         let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))         let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item])         let section = NSCollectionLayoutSection(group: group)         section.orthogonalScrollingBehavior = .groupPaging         let layout = UICollectionViewCompositionalLayout(section: section)         return layout     } }
2
0
970
Oct ’20
NSPersistentCloudKitContainer: How to know initial sync between CloudKit has happened?
I am looking into using the new NSPersistentCloudKitContainer to sync some internal data for my app. Generally it works great, but I have one scenario that I cannot figure out.Here the basic scenario, there is a single record in CloudKit that created and used to keep track of some internal state. Keeping it the cloud allows for two cases: when the user open the app on another device (say an iPad) and when the user re-installs the app on the same device.If its indeed the very first time the user is using the app on any device, I need to create the record with a bunch of default initial values. I am okay with spending a little time at app startup determining if its a brand new user or an existing user installing on another device.I thought maybe observing NSPersistentStoreRemoteChangeNotification would provide a useful point in time that I can say "ah ha, now I know its a new user, or an existing user". However its gets called a lot and I cannot find anything in its userInfo that gives me a definitive answer to my question.Any suggestions?joey
4
0
3.4k
Aug ’19