@DTS Engineer Ended up making it work with a VStack after trying different other options. I dropped the custom alignment guide in favor of using offset. Here is the code if anyone is interested:
struct OnboardingGreeting: View {
let carouselSpacing: CGFloat = 7
let carouselItemSize: CGFloat = 110
let carouselVelocities: [CGFloat] = [0.5, -0.25, 0.3, 0.2]
let iconSize: CGFloat = 95
var body: some View {
VStack(spacing: 0) {
VStack(spacing: carouselSpacing) {
ForEach(carouselVelocities, id: \.self) { velocityValue in
InfiniteHorizontalCarousel(
albumNames: albums,
artistNames: artists,
itemSize: carouselItemSize,
itemSpacing: carouselSpacing,
velocity: velocityValue
)
}
}
.overlay {
LinearGradient(
stops: [
.init(color: .black.opacity(0.5), location: 0.07),
.init(color: .clear, location: 0.12)
],
startPoint: .bottom,
endPoint: .top
)
}
VStack(spacing: 8) {
RoundedRectangle(cornerRadius: 18)
.fill(.red)
.frame(width: iconSize, height: iconSize)
Text("Welcome to Music Radar")
.font(.title)
.fontDesign(.serif)
.bold()
Text("It's your place to find new friends and share your tastes with the world. Enjoy!")
.font(.body)
.fontDesign(.serif)
}
.offset(y: -(iconSize/2))
Spacer()
PrimaryActionButton("Next") {
// navigate to the next screen
}
.padding(.horizontal)
}
.ignoresSafeArea(edges: .top)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.statusBarHidden()
}
}
and the final result:
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: