I create two class from video lesson:
import SwiftUI
struct ScrollImage: View {
let picture: ImageResource
var physique: some View {
Picture(picture)
.resizable()
.scaledToFit()
.border(Shade.purple, width: 1)
.clipShape(RoundedRectangle(cornerRadius: 20, type: .steady))
.scrollTransition(.interactive, axis: .vertical) { content material, section in
content material
.scaleEffect(section.isIdentity ? 1 : 0.85)
.opacity(section.isIdentity ? 1 : 0.6)
}
}
}
#Preview {
ScrollImage(picture: .automotive)
}
import SwiftUI
struct Scrolling: View {
var physique: some View {
ScrollView {
LazyVStack(spacing: 20) {
ScrollImage(picture: .automotive)
ScrollImage(picture: ._111)
ScrollImage(picture: .automotive)
ScrollImage(picture: ._111)
ScrollImage(picture: .automotive)
ScrollImage(picture: ._111)
ScrollImage(picture: .automotive)
ScrollImage(picture: ._111)
}
.padding()
}
}
}
#Preview {
Scrolling()
}
Preview:
Why cannot I scroll by means of these photos?