File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Sources/SnapshotPreviewsCore Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ public struct Preview: Identifiable {
4242 self . orientation = orientation
4343 self . layout = layout
4444 displayName = preview. descendant ( " displayName " ) as? String
45- let source = preview. descendant ( " source " ) ?? preview. descendant ( " dataSource " , " preview " ) !
45+ guard let source = preview. descendant ( " source " ) ?? preview. descendant ( " dataSource " , " preview " ) else {
46+ assertionFailure ( " Preview \( preview) missing source, found: \( preview. children) " )
47+ return nil
48+ }
4649 let _view : @MainActor ( ) -> any View
4750 if let source = source as? MakeViewProvider {
4851 _view = {
@@ -59,9 +62,11 @@ public struct Preview: Identifiable {
5962 return UIViewControllerWrapper ( source. makeViewController)
6063 }
6164 } else {
65+ print ( " Preview \( preview) ( \( displayName ?? " no display name " ) ) did not have matching source type " )
6266 return nil
6367 }
6468 #else
69+ print ( " Preview \( preview) ( \( displayName ?? " no display name " ) ) did not have matching source type " )
6570 return nil
6671 #endif
6772 }
You can’t perform that action at this time.
0 commit comments