33 lines
987 B
Swift
33 lines
987 B
Swift
import SwiftUI
|
|
|
|
struct OnboardingCarouselView: View {
|
|
let images: [String]
|
|
let step: Int
|
|
|
|
var body: some View {
|
|
GeometryReader { geometry in
|
|
let width = geometry.size.width
|
|
let height = geometry.size.height
|
|
|
|
ZStack {
|
|
if images.isEmpty {
|
|
Image(systemName: "photo")
|
|
.font(.largeTitle)
|
|
.foregroundStyle(Color.secondary)
|
|
} else {
|
|
HStack(spacing: 0) {
|
|
ForEach(Array(images.enumerated()), id: \.offset) { _, name in
|
|
Image(name)
|
|
.resizable()
|
|
.scaledToFit()
|
|
.frame(width: width, height: height)
|
|
}
|
|
}
|
|
.offset(x: -CGFloat(step) * width)
|
|
}
|
|
}
|
|
.clipped()
|
|
}
|
|
}
|
|
}
|