Several users are seeing a crash that occurs when configureCell is called for a UICollectionView. This seems to occur specifically for cells that add SwiftUI views using UIHostedConfiguration.
0 libsystem_kernel.dylib 0xc1d4 __pthread_kill + 8
1 libsystem_pthread.dylib 0x7ef8 pthread_kill + 268
2 libsystem_c.dylib 0x77ad8 abort + 128
3 libswiftCore.dylib 0x3cc1a4 swift::fatalError(unsigned int, char const*, ...) + 134
4 libswiftCore.dylib 0x3cc1c4 swift::warningv(unsigned int, char const*, char*) + 30
5 libswiftCore.dylib 0x3cc810 swift_beginAccess + 538
6 libswiftCore.dylib 0x3cc864 swift_beginAccess + 84
7 SwiftUI 0x947a0 _UIHostingView._rootView.getter + 92
8 SwiftUI 0x94668 _UIHostingView.makeRootView() + 432
9 SwiftUI 0x943b8 _UIHostingView.updateRootView() + 264
10 SwiftUICore 0xa0d000 closure #1 in ViewRendererHost.updateGraph() + 204
11 SwiftUICore 0x1f1308 partial apply for thunk for @escaping @callee_guaranteed () -> () + 28
12 AttributeGraph 0x144a8 AGGraphWithUpdate + 84
13 SwiftUICore 0x4a5f60 @objc closure #1 in closure #1 in closure #1 in static Update.syncMain(_:) + 84
14 SwiftUICore 0x3620 wait_for_lock + 112
15 SwiftUICore 0x3588 _MovableLockLock + 68
16 SwiftUICore 0x5bb6d4 _ViewList_ReleaseElements.deinit + 64
17 SwiftUICore 0x5bb838 _ViewList_ReleaseElements.__deallocating_deinit + 16
18 libswiftCore.dylib 0x3d783c _swift_release_dealloc + 56
19 libswiftCore.dylib 0x3d8950 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 160
20 SwiftUICore 0x7cf7bc assignWithTake for _ViewList_View + 52
21 SwiftUICore 0x18dbe0 assignWithTake for ExclusiveGesture + 76
22 SwiftUI 0x13aff8 outlined assign with take of ModifiedContent<TableRowView, CollectionViewCellModifier> + 100
23 SwiftUI 0x1394fc specialized PlatformListCell<>.defaultConfigureContent(_:transaction:) + 296
24 SwiftUI 0xb8308 CollectionViewListDataSource.configureCell(_:transaction:context:) + 1200
25 SwiftUI 0xb8e20 ShadowListDataSource.configureCell(_:transaction:context:) + 1336
26 SwiftUI 0xb670c closure #1 in UICollectionViewListCoordinatorBase.updateListContents(_:) + 452
27 SwiftUI 0xead7b4 partial apply for closure #1 in ListCoreDataSource.visitRowAt<A>(_:visitor:) + 32
28 SwiftUI 0xb6160 partial apply for closure #1 in ListCoreDataSource.visitRowAt<A>(_:visitor:) + 16
29 SwiftUI 0x171e1c Optional.map<A, B>(_:) + 516
30 SwiftUI 0xb98d8 ListCoreDataSource.visitRowAt<A>(_:visitor:) + 1064
31 SwiftUI 0x33b3c ListCoreDataSource.visitContent<A>(atRow:visitor:) + 536
32 SwiftUI 0xb5478 UICollectionViewListCoordinatorBase.updateListContents(_:) + 1696
33 SwiftUI 0x942dac closure #1 in performUpdates #1 <A, B>() in UICollectionViewListCoordinatorBase.update(_:to:transaction:performDiff:) + 416
34 SwiftUI 0x3261cc thunk for @escaping @callee_guaranteed (@unowned Bool) -> () + 48
35 SwiftUI 0x94cf88 closure #1 in UpdateCoalescingCollectionView.performBatchUpdates(_:completion:) + 308
36 SwiftUI 0x3261cc thunk for @escaping @callee_guaranteed (@unowned Bool) -> () + 48
37 UIKitCore 0x2b9bbc -[UICollectionView _updateAnimationDidStop:finished:] + 1240
38 UIKitCore 0xa02c38 __118-[UICollectionView _startViewAnimationsWithContext:oldVisibleViews:viewAnimator:viewAnimationsCompletedDispatchGroup:]_block_invoke + 36
39 UIKitCore 0x7d788 __47-[UICollectionViewAnimation startWithAnimator:]_block_invoke_3 + 272
40 UIKitCore 0x7bfb0 __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 36
41 UIKitCore 0x7be94 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 624
42 UIKitCore 0x7abb0 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 436
43 UIKitCore 0x86f38 -[UIViewAnimationState animationDidStop:finished:] + 192
44 QuartzCore 0x4e3cc run_animation_callbacks(void*) + 132
45 libdispatch.dylib 0x40d0 _dispatch_client_callout + 20
46 libdispatch.dylib 0x129e0 _dispatch_main_queue_drain + 980
47 libdispatch.dylib 0x125fc _dispatch_main_queue_callback_4CF + 44
48 CoreFoundation 0x56204 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
49 CoreFoundation 0x53440 __CFRunLoopRun + 1996
50 CoreFoundation 0x52830 CFRunLoopRunSpecific + 588
51 GraphicsServices 0x11c4 GSEventRunModal + 164
52 UIKitCore 0x3d2eb0 -[UIApplication _run] + 816
53 UIKitCore 0x4815b4 UIApplicationMain + 340
The crashes started occurring in October and only for iOS 18 users (all versions from 18.0.0 to 18.2.0).
We have several cell types that use SwiftUI views and I haven't been able to isolate the issue to any particular cell type.
I have tried setting contentConfiguration = nil in prepareForReuse but this didn't help.
Has there been a change in UICollectionView/UIHostingConfiguration in iOS 18? Any ideas on how this can be further investigated or resolved?