Hello @ronnqvist I did tried it and it's crashing with the toolchain (swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain).
swift package \
--toolchain "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain" \
--allow-writing-to-directory "../docs/develop" \
generate-documentation \
--target VitaminPlay \
--target AccentColor \
--target Accordion \
--target ArticleCard \
--target Assets \
--target Button \
--target Carousel \
--target Checkbox \
--target Chip \
--target DesignTokens \
--target Divider \
--target Fonts \
--target IconButton \
--target Link \
--target Loader \
--target Price \
--target ProductCard \
--target ScoreRating \
--target Shared \
--target StarRating \
--target Sticker \
--target TabView \
--target TextEditor \
--target TextField \
--target VitaminToggle \
--output-path "../docs/develop" \
--transform-for-static-hosting \
--enable-experimental-combined-documentation
Generic signature: <Ď„_0_0, Ď„_0_1 where Ď„_0_0 : View, Ď„_0_1 : Downloader, Ď„_0_1.Id == URL, Ď„_0_1.Value == Image>
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Pass '-Xfrontend -disable-round-trip-debug-types' to disable this assertion.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Carousel+CardContent.swift /Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Carousel.swift /Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Debug/CardContentDebugOptions.swift /Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Models/CardContentViewModel.swift /Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Models/CardModel.swift /Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Models/CardViewModel.swift /Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Models/Progress.swift -emit-dependencies-path /Users/mac-JMACKO01/Developer/generate_doc/code/.build/arm64-apple-macosx/debug/Carousel.build/Carousel+CardContent.d -emit-reference-dependencies-path /Users/mac-JMACKO01/Developer/generate_doc/code/.build/arm64-apple-macosx/debug/Carousel.build/Carousel+CardContent.swiftdeps -target arm64-apple-macosx11.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -I /Users/mac-JMACKO01/Developer/generate_doc/code/.build/arm64-apple-macosx/debug/Modules -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/mac-JMACKO01/Developer/generate_doc/code/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/mac-JMACKO01/Developer/generate_doc/code -resource-dir /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/mac-JMACKO01/Developer/generate_doc/code -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name Carousel -package-name code -in-process-plugin-server-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.0 -target-sdk-name macosx15.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -parse-as-library -o /Users/mac-JMACKO01/Developer/generate_doc/code/.build/arm64-apple-macosx/debug/Carousel.build/Carousel+CardContent.swift.o -index-store-path /Users/mac-JMACKO01/Developer/generate_doc/code/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1. Apple Swift version 6.1-dev (LLVM 89ccf4b8a46135a, Swift 6a5ae8d5df144dd)
2. Compiling with effective version 5.10
3. While evaluating request IRGenRequest(IR Generation for file "/Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Carousel+CardContent.swift")
4. While emitting IR SIL function "@$s8Carousel11CardContentV4body7contentQr7SwiftUI014_ViewModifier_C0VyACyxq_GG_tFAF0H0PAFE8onChange2of7performQrqd___yqd__ctSQRd__lFQOyAF08ModifiedC0VyAlFEAmnOQrqd___yqd__ctSQRd__lFQOyAlFEAmnOQrqd___yqd__ctSQRd__lFQOyAlFEAmnOQrqd___yqd__ctSQRd__lFQOyAlFE0J6AppearAOQryycSg_tFQOyAlFE7overlay_9alignmentQrqd___AF9AlignmentVtAfKRd__lFQOyAlFEAT_AUQrqd___AWtAfKRd__lFQOyAL6SharedE2if_9transformQrSbyXK_qd__xXEtAfKRd__lFQOyAlFE5frame5width6heightAUQr12CoreGraphics7CGFloatVSg_A5_AWtFQOyAlFE7gesture_9includingQrqd___AF11GestureMaskVtAF7GestureRd__lFQOyAlFE10preference3key5valueQrqd__m_5ValueQyd__tAF13PreferenceKeyRd__lFQOyAlFE8position1x1yQrA4__A4_tFQOyAlFEA_A0_A1_AUQrA5__A5_AWtFQOyAlFE0U6EffectyQrSo17CGAffineTransformVFQOyAF6ZStackVyAF05TupleH0VyAF7ForEachVySaySiGSiAlFE0J9DisappearAOQrAS_tFQOyAlFEArOQrAS_tFQOyAlFE0J10TapGesture5countAOQrSi_yyctFQOyAlFEA17_A18_A19_QrA4__A4_tFQOyAlFEA_A0_A1_AUQrA5__A5_AWtFQOyAlXEAY_AZQrSbyXK_qd__xXEtAfKRd__lFQOyAlFEAT_AUQrqd___AWtAfKRd__lFQOyAC0bH033_52A3C2B362B4C7D5ECC1F72FBFD8C439LLVyxq__G_AF5GroupVyAF012_ConditionalC0VyAlFE6border_A0_Qrqd___A4_tAF10ShapeStyleRd__lFQOyAlFEA_A0_A1_AUQrA5__A5_AWtFQOyAlFE4fontyQrAF4FontVSgFQOyAlFE10background_AUQrqd___AWtAfKRd__lFQOyAF4TextV_AF5ColorVQo__Qo__Qo__A51_Qo_AF05EmptyH0VGGQo__AlFE6zIndexyQrSdFQOyAlFE11scaleEffect_6anchorQrA4__AF9UnitPointVtFQOyA60__Qo__Qo_Qo__Qo__Qo__Qo__Qo__Qo_SgGSg_A28_ySnySiGSiAlFEA17_A18_A19_QrA4__A4_tFQOyAlFEA_A0_A1_AUQrA5__A5_AWtFQOyAF5ShapePAFE6stroke9lineWidthQrA4__tFQOyAF9RectangleV_Qo__Qo__Qo_GSgA28_yA77_SiAlFE16allowsHitTestingyQrSbFQOyAlFEA61_yQrSdFQOyAlFEA17_A18_A19_QrA4__A4_tFQOyAlFEA_A0_A1_AUQrA5__A5_AWtFQOyAF6VStackVyA26_yAlFEA_A0_A1_AUQrA5__A5_AWtFQOyA79_AFE4fill_5styleQrqd___AF9FillStyleVtAFA42_Rd__lFQOyA83__A51_Qo__Qo__A49_tGG_Qo__Qo__Qo__Qo_GSgtGG_Qo__Qo__Qo__AX21ReadSizePreferenceKeyVQo__AF13_EndedGestureVyAF15_ChangedGestureVyAF19GestureStateGestureVyAF11DragGestureVAC15GestureProgressA34_LLOyxq__GGGGQo__Qo__AlFE7clipped11antialiasedQrSb_tFQOyAlFE0E5Shape_6eoFillQrqd___SbtAFA78_Rd__lFQOyA129__A83_Qo__Qo_Qo__AlFEA89_yQrSbFQOyA38_yA40_yAlFEA47__AUQrqd___AWtAfKRd__lFQOyA91_yA26_yA49__A49_A49_tGG_A51_Qo_A57_GG_Qo_Qo__A38_yA40_yAlFEA89_yQrSbFQOyA97__Qo_A57_GGQo__Qo__SiQo__SiQo__A4_Qo_AX17AnimationCompleteVyA4_GG_A29_Qo_AF13GeometryProxyVcfU_".
for expression at [/Users/mac-JMACKO01/Developer/generate_doc/code/Sources/Components/Carousel/Carousel+CardContent.swift:204:20 - line:410:5] RangeText="{ proxy in
// Carousel is represented here with e `ZStack` containing all the cards that is moved
// horizontally with drag gestures or animated to a particular card.
ZStack {
/// Ignore view if there are no items.
if numberOfItems > 0 {
/// The `wideIndex` refers to the index when loop is enabled for wrapped around cards
/// that are "out of rage" e.g. in the negative or grater than the card count.
ForEach(visibleIndexes, id: \.self) { wideIndex in
let index = convertLoopIndexToInRange(wideIndex, count: numberOfItems)
// This check is for when changing the `numberOfItems` when things go our of sync for a
// short while.
if index < cardContentViewModel.cardViewModels.count {
// This is the individual card view.
CardView(cardViewModel: cardContentViewModel.cardViewModels[index],
placeholderView: placeholderView,
debugOptions: debugOptions)
.overlay(
Group {
if debugOptions.showWideIndex {
Text("\(wideIndex)")
.foregroundColor(Color.black) // Use `.foregroundStyle` in iOS 15.
.background(Color.white.opacity(0.5))
.font(.body)
.frame(height: .infinity)
.border(.orange)
} else {
EmptyView()
}
}
, alignment: .top)
.if(debugOptions.disableScale == false) {
// Scaling effects for selected index.
$0
.scaleEffect(selectedIndex == wideIndex ? 2 : 1)
.zIndex(zIndex(forCardIndex: wideIndex))
}
.frame(width: cardLength, height: cardLength)
// position uses the top leading position.
.position(
x: CGFloat(wideIndex) * cardLength + cardLength/2,
y: cardLength/2
)
.onTapGesture {
// Tap on a visible card to jump (animate) to it.
jump(toIndex: wideIndex)
}
.onAppear { progress?(Progress(index: index, state: .onAppear)) }
.onDisappear { progress?(Progress(index: index, state: .onDisappear)) }
}
} // ForEach
}
if debugOptions.showDebugBorders {
ForEach(0..<numberOfItems, id: \.self) { index in
Rectangle()
.stroke(lineWidth: 2)
.frame(width: cardLength, height: cardLength)
.position(
x: CGFloat(index) * cardLength + cardLength/2,
y: cardLength/2
)
}
}
if debugOptions.showRulers {
// This debug option shows a ruler with offset values for each card.
ForEach(0..<numberOfItems, id: \.self) { index in
VStack {
Rectangle()
.fill(.blue)
.frame(width: 2, height: cardLength * 1.5)
Text(String(format: "%.02f", -1 * CGFloat(index) * cardLength))
.font(.caption)
}
.frame(width: 50, height: cardLength * 2)
.position(
x: CGFloat(index) * cardLength + cardLength/2,
y: cardLength/2
)
.zIndex(10)
.allowsHitTesting(false)
}
}
} // ZStack
// Groups the geometry so all the positions are moved at once. Use `.geometryGroup()` when
// target is in iOS 17.
.transformEffect(.identity)
// The size of the `ZStack` is the with of all the cards.
.frame(width: cardLength * CGFloat(numberOfItems), height: cardLength, alignment: .leading)
.position(
// Position is based around the center of the view, move it to be the offset minus half the
// width plus half the view the ZStack sits inside plus half a card width.
x: offset + centerOffset
+ (cardLength * CGFloat(numberOfItems))/2
+ proxy.size.width/2 - cardLength/2,
y: proxy.size.height/2
)
// So the proxy size is stored.
.preference(key: ReadSizePreferenceKey.self, value: proxy.size)
.gesture(DragGesture()
// Using `updating` to get the "gesture started" events.
.updating($gestureState) { value, state, transaction in
switch state {
case .inactive:
state = .started
let startingOffset = offset(fromIndex: selectedIndex, withOffset: value.translation.width)
// TODO: Modifying state during view update, this will cause undefined behavior.
offsetAtDragStart = startingOffset
print("drag started offset: trans \(value.translation.width), "
+ "index \(selectedIndex), "
+ "offset \(startingOffset) == \(offsetAtDragStart). thread: \(Thread.current)")
case .started:
state = .changed
case .changed:
break
}
}
.onChanged { dragGestureChanged(translationX: $0.translation.width) }
.onEnded { dragGestureEnded(translationX: $0.translation.width)}
) // gesture
// Use the zoomed card height for the width.
.frame(width: proxy.size.width, height: cardLength * 2)
.if(debugOptions.clipViews) {
$0
.contentShape(Rectangle()) // Blocks hit testing
.clipped() // Clips the view
}
.overlay(
Group {
// Debug view to show the state of the visible and pre-fetched cards.
if debugOptions.showFetchDebugView {
VStack {
Text(.init(debugIndexesString()))
Text("Length: \(Int(cardLength))")
Text("offset: \(Int(offset))")
}
.background(Color.white.opacity(0.85))
} else {
EmptyView()
}
}
.allowsHitTesting(false)
, alignment: .top)
.overlay(
Group {
// Line for the debug ruler option.
if debugOptions.showRulers {
Rectangle()
.fill(.black)
.frame(width: 1, height: cardLength * 3)
.allowsHitTesting(false)
} else {
EmptyView()
}
}
)
.onAppear {
print("updateVisibleIndexesAtRest - onAppear")
// Update the visible cards when the view first appears.
updateVisibleIndexesAtRest()
}
// TODO: iOS 17 use `.onChange(of: selectedIndex) { oldValue, _ in }`
.onChange(of: numberOfItems) { newValue in
// If the number of items changes we need to update the collection of Card View Models.
updateCardViewModels(numberOfItems: newValue)
}
.onChange(of: selectedIndex) { [selectedIndex] newValue in
// Keep the old index up to date.
oldIndex = selectedIndex
}
.onChange(of: offset) { [offsetAtDragStart] newValue in
// Update on change of `offset` so new visible cards are shown when dragging.
if debugOptions.updateOnOffset && updateVisible {
let range = min(offsetAtDragStart, newValue)...max(offsetAtDragStart, newValue)
print("updateVisibleIndexesAtRest - onChange(of: offset) range: \(range) "
+ "... offsetAtDragStart: \(offsetAtDragStart)")
visibleIndexes = calculateVisibleIndexes(selectedIndex: selectedIndex,
offsetRange: range,
numberOfItems: numberOfItems,
itemWidth: cardLength,
viewWidth: viewSize.width,
centerOffset: centerOffset)
}
}
.onAnimationCompleted(for: offset) {
// Update the visible cards at the end of the animation for `offset`. This isn't always at
// the end of a gesture.
if debugOptions.updateOnAnimationComplete {
print("updateVisibleIndexesAtRest - onAnimationCompleted")
// Updates on drag (instead of `.onChange(of: dragOffset)`), as well as when a on tap
// animation has finished.
offsetAtDragStart = offset(fromIndex: selectedIndex, withOffset: 0)
updateVisibleIndexesAtRest()
}
}
.onChange(of: visibleIndexes) { [visibleIndexes] newVisibleIndexes in
print("\(visibleIndexes) => \(newVisibleIndexes)")
print("fetching: \(fetchableIndexes)")
// When the visible cards change, fetch content for all the necessary cards.
cardContentViewModel.fetchCardModels(fetchableIndexes: fetchableIndexes)
}
"
#0 0x0000000105e1782c (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10572382c)
#1 0x0000000105e15ff8 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x105721ff8)
#2 0x0000000105e17e74 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x105723e74)
#3 0x0000000195da6584 (/usr/lib/system/libsystem_platform.dylib+0x18047a584)
#4 0x0000000195d75c20 (/usr/lib/system/libsystem_pthread.dylib+0x180449c20)
#5 0x0000000195c82a30 (/usr/lib/system/libsystem_c.dylib+0x180356a30)
#6 0x0000000105f56408 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x105862408)
#7 0x0000000100e59820 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100765820)
#8 0x0000000100e59b6c (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100765b6c)
#9 0x0000000100e523bc (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10075e3bc)
#10 0x0000000100e94718 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x1007a0718)
#11 0x0000000100e93e2c (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10079fe2c)
#12 0x0000000100d2dcc0 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100639cc0)
#13 0x0000000100e44aec (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100750aec)
#14 0x0000000100e93390 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10079f390)
#15 0x0000000100e4d45c (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10075945c)
#16 0x0000000100e469ec (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x1007529ec)
#17 0x000000010093f2a4 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10024b2a4)
#18 0x000000010093bc2c (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100247c2c)
#19 0x000000010093b08c (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10024708c)
#20 0x000000010094749c (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x10025349c)
#21 0x000000010093cf58 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100248f58)
#22 0x000000010093c624 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100248624)
#23 0x000000010072ac50 (/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a.xctoolchain/usr/bin/swift-frontend+0x100036c50)
#24 0x00000001959eb154
I did fill a feedback FB15344007 if you want to test this on your side.
Hope it helps.