1
struct HomeList: View {
 var body: some View {
  ScrollView { // ERROR HERE: 'Argument passed to call that takes no arguments'
   HStack {
    ForEach(0.. < 3) {
     item in
      ScrollView()
    }
   }
   Spacer()
  }
 }
}

It always throws the error Argument passed to call that takes no argument, only one person has had this issue and they said restarting their project worked for them,

I tried it and the error still gets thrown? Is it a bug or?

Thanks,

Nathan

1 Answer 1

1

You cannot call just ScrollView() -> this needs an argument or a content like e.g. so:

struct ContentView: View {

    var body: some View {
        ScrollView { // ERROR HERE: 'Argument passed to call that takes no arguments'
            HStack {
                ForEach(0..<3) {
                    item in
                    ScrollView {
                        Text("a")
                    }
                }
            }
            Spacer()
        }
    }
}
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, still sends the same error, I tried that anyway too and it still threw the same error
Ah, found it. Your script helped and it was the correct way, it was also because my function was called 'ScrollView' too which obviously interfered with the ScrollView itself, so I simply just changed the name of the function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.