ScrollView(.horizontal, showsIndicators: false, content: {
LazyHGrid(rows: gridLayout2, alignment: .center, spacing: columnSpacing, pinnedViews: [], content: {
Section(
header: SectionView(rotateClockwise: false, headerText: "Premium Store"),
footer: SectionView(rotateClockwise: true, headerText: "Premium Store")) {
ForEach(premiumStoreItems) { item in
StoreItemView(storeItem: item)
}
}
}) //: LAZYHGRID
.frame(height: 200)
.padding(15)
})
The crash is occurring in the ForEach loop.
If I comment the ForEach and pass in 1 specific item from my array, it works fine. However I need to display all my items in my array.
I am not sure what to do here.
The following code works fine.
//ForEach(premiumStoreItems) { item in
StoreItemView(storeItem: premiumStoreItems[0])
//}
CRASH LOG (sorry I didnt know where to get it)
Application Specific Information:
Fatal error: each layout item may only occur once: file SwiftUI, line 0
------ FULL CRASH LOG
Process: AppExample001 [3525] Path: /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/C93C2BE8-C23A-4813-9D6C-110E87786FFE/data/Containers/Bundle/Application/40562FF7-7B66-4BE4-915A-5A2A35AD3EC2/AppExample001.app/AppExample001 Identifier: AppExample001 Version: 1.0 (1) Code Type: X86-64 (Native) Parent Process: launchd_sim [2488] Responsible: SimulatorTrampoline [611] User ID: 501
Date/Time: 2021-04-07 12:23:50.173 -0400 OS Version: macOS 11.2.3 (20D91) Report Version: 12 Bridge OS Version: 5.2 (18P4347) Anonymous UUID: 5A68DF80-DD1B-1132-4597-BBC26C334627
Time Awake Since Boot: 7000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4 Termination Reason: Namespace SIGNAL, Code 0x4 Terminating Process: exc handler [3525]
ID Vend/Dev 95f5 687f1002 Seconds Ago ID Type 6900.0 95f5 Attach
Application Specific Information: Fatal error: each layout item may only occur once: file SwiftUI, line 0
CoreSimulator 732.18.6 - Device: iPhone SE (2nd generation) (C93C2BE8-C23A-4813-9D6C-110E87786FFE) - Runtime: iOS 14.4 (18D46) - DeviceType: iPhone SE (2nd generation)
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libswiftCore.dylib 0x00007fff2fc85004 assertionFailure(::file:line:flags:) + 532 1 com.apple.SwiftUI 0x00007fff572e9d24 ViewCache.commitPlacedChildren(from:to:) + 4020 2 com.apple.SwiftUI 0x00007fff571a1f16 specialized IncrementalChildPlacements.updateValue() + 1558 3 com.apple.SwiftUI 0x00007fff572be37f partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init(:) + 15 4 com.apple.AttributeGraph 0x00007fff4cd78723 AG::Graph::UpdateStack::update() + 505 5 com.apple.AttributeGraph 0x00007fff4cd78bb9 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 335 6 com.apple.AttributeGraph 0x00007fff4cd7d85f AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 523 7 com.apple.AttributeGraph 0x00007fff4cd8edc5 AGGraphGetValue + 203 8 com.apple.SwiftUI 0x00007fff572edac0 IncrementalPreference.children.getter + 48 9 com.apple.SwiftUI 0x00007fff572edb95 IncrementalPreference.value.getter + 85 10 com.apple.SwiftUI 0x00007fff572ede1c protocol witness for Rule.value.getter in conformance IncrementalPreference + 28 11 com.apple.AttributeGraph 0x00007fff4cd91907 dispatch thunk of Rule.value.getter + 7 12 com.apple.SwiftUI 0x00007fff570e9a18 implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init(_:) + 56 13 com.apple.AttributeGraph 0x00007fff4cd78723 AG::Graph::UpdateStack::update() + 505 14 com.apple.AttributeGraph 0x00007fff4cd78bb9 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 335 15 com.apple.AttributeGraph 0x00007fff4cd7d318 AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, bool*) + 130 16 com.apple.AttributeGraph 0x00007fff4cd8ee13 AGGraphGetValue + 281 17 com.apple.SwiftUI 0x00007fff57987807 GraphHost.updatePreferences() + 39 18 com.apple.SwiftUI 0x00007fff57458cbf ViewGraph.updateOutputs(at:) + 95 19 com.apple.SwiftUI 0x00007fff573f04e4 specialized closure #1 in ViewRendererHost.render(interval:updateDisplayList:) + 1316 20 com.apple.SwiftUI 0x00007fff573ed28e specialized ViewRendererHost.render(interval:updateDisplayList:) + 366 21 com.apple.SwiftUI 0x00007fff57a59c0e specialized UIHostingController._render(seconds:) + 46 22 com.apple.dt.XCPreviewKit 0x000000010c117536 0x10c10a000 + 54582 23 com.apple.dt.XCPreviewKit 0x000000010c1246eb 0x10c10a000 + 108267 24 com.apple.dt.XCPreviewKit 0x000000010c11b91f 0x10c10a000 + 71967 25 com.apple.dt.XCPreviewKit 0x000000010c11bc08 0x10c10a000 + 72712 26 com.apple.dt.XCPreviewKit 0x000000010c11ddff 0x10c10a000 + 81407 27 com.apple.dt.XCPreviewKit 0x000000010c11c274 0x10c10a000 + 74356 28 com.apple.dt.XCPreviewKit 0x000000010c1134e3 0x10c10a000 + 38115 29 com.apple.dt.XCPreviewKit 0x000000010c112eee 0x10c10a000 + 36590 30 libdispatch.dylib 0x00007fff2010532f _dispatch_call_block_and_release + 12 31 libdispatch.dylib 0x00007fff20106508 _dispatch_client_callout + 8 32 libdispatch.dylib 0x00007fff20112ff7 dispatch_main_queue_callback_4CF + 1045 33 com.apple.CoreFoundation 0x00007fff2038fdbb CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 34 com.apple.CoreFoundation 0x00007fff2038a63e __CFRunLoopRun + 2685 35 com.apple.CoreFoundation 0x00007fff203896d6 CFRunLoopRunSpecific + 567 36 com.apple.GraphicsServices 0x00007fff2c257db3 GSEventRunModal + 139 37 com.apple.UIKitCore 0x00007fff24696cf7 -[UIApplication run] + 912 38 com.apple.UIKitCore 0x00007fff2469bba8 UIApplicationMain + 101 39 com.apple.SwiftUI 0x00007fff5791abc7 closure #1 in KitRendererCommon(:) + 119 40 com.apple.SwiftUI 0x00007fff5791ab3f runApp(:) + 143 41 com.apple.SwiftUI 0x00007fff5745212d static App.main() + 61 42 com.oneorangetree.AppExample001 0x000000010bfcaf4e static AppExample001App.$main() + 78 43 com.oneorangetree.AppExample001 0x000000010bfcafd4 main + 20 44 libdyld.dylib 0x00007fff2025a3e9 start + 1