When trying to debug a mysterious app crash pointing to some layoutIfNeeded() method call, me and my QA team member reduced it to this sample app.
struct ContentView: View {
@State var isPresented = false
var body: some View {
VStack {
Button {
isPresented = true
} label: {
Text("show popover")
}
.popover(isPresented: $isPresented) {
Text("hello world")
}
}
.padding()
}
}`
This code crashes on his iPad iOS 18.1.0 22B5034E with EXC_BAD_ACCESS error. It is not reproducible on simulator or on device with iOS 18.2 or iOS 17.
Is this a known issue? Are there any known workarounds? I've found similar posts here
https://developer.apple.com/forums/thread/769757
https://developer.apple.com/forums/thread/768544
But they are about more specific cases.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
When trying to use 'modern' collection views (DiffableDataSource + CompositionalLayout + list sections) I've found a bug that is unique to iOS 16 it seems. When trying to reorder cells on a pgesheet or on a formsheet, (essentially any non-fullscreen presentation mode), the cells will start to disappear and behave unpredictably.
For example, if you download a source code from https://developer.apple.com/documentation/uikit/views_and_controls/collection_views/implementing_modern_collection_views and just change line OutlineViewController:191 from
navigationController?.pushViewController(viewController.init(), animated: true)
to
self.present(viewController.init(), animated: true) you will see that at some point when reordering, some cell will disappear.
When trying to implement Drag & Drop manually, the same thing happens (and it seems that it happens even more often). I've found an example of custom implementation of reorder on Github and everything worked perfectly on fullscreen, but on pagesheet the same bug happens.
Is there any workaround or Drag & Drop is impossible on modal screen completely as of iOS 16? The only way I know to implement reorder is to downgrade to UITableView that has no such bug.