Files
Cable/Cable/OnboardingCarouselView.swift
2025-10-03 00:15:52 +02:00

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()
}
}
}