NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

How can I use a ScrollView with a swipe gesture?

Forums > SwiftUI

Hi, this is my code:

struct SolverFullScreenCover: View {
    @Environment(\.presentationMode) var presentationMode
    var systemSolver: SystemSolver

    var body: some View {
        ScrollView {
            fullScreenHeader(systemSolver: systemSolver)  // This is a view from another file

The gesture works, but the ScrollView can't scroll. Thanks for the help in advance!


Also, I have another problem: The dismiss Button doesn't work when I try to use ForEach.

struct ChooserRow: View {
    @State private var isShown = false

  let columns = [
      GridItem(.adaptive(minimum: 280 , maximum: 1000), spacing: 30)

  var systemSolvers: [SystemSolver]

  var body: some View {
      ScrollView {
          LazyVGrid(columns: columns, alignment: .center) {

              ForEach(systemSolvers) { solver in
                  ChooserButton(systemSolver: solver, frame: [350, 350])


struct ChooserRow_Previews: PreviewProvider {
  static var previews: some View {
      ChooserRow(systemSolvers: ModelData().systemSolvers)


Hacking with Swift is sponsored by Stream

SPONSORED Check out Stream's cross-platform open source chat SDK on GitHub! Write once and deploy your app with fully featured chat UI on iOS and macOS.

Go to GitHub

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.