71

If the content of the ScrollView is bigger than the screen, while scrolling, the scrollbar on the side appears. I couldn't find anything to help me hide it.

Hamoonist
  • 2,286
  • 3
  • 19
  • 36

4 Answers4

164

You can use showsIndicators: false to hide the indicator:

ScrollView(showsIndicators: false) {
    // ...
}
JWK
  • 3,345
  • 2
  • 19
  • 27
5

You just have to use the scrollView initializer and set the parameter showsIndicators property to false within the initializer only.

ScrollView(.vertical, showsIndicators: false) {
     //your content for scrollView
}

Hope this has resolved your query.

Nirav Jain
  • 5,088
  • 5
  • 40
  • 61
0

if you need to hide both scrollers:

ScrollView(showsIndicators: false) {
  //your code
}

__

If you need to hide only one scroller, but to have ability to scroll in both directions:

need to use Introspect:

ScrollView() {
    // Some Content
}
.introspectScrollView{ 
    $0.hasHorizontalScroller = false
    $0.hasVerticalScroller = true
}

as result:

  • horisontal scroller invisible
  • vertical scroller visible;
Andrew_STOP_RU_WAR_IN_UA
  • 9,318
  • 5
  • 65
  • 101
0

Show / Hide Indicators in ScrollView SwiftUI

Hide Indicators in ScrollView SwiftUI

  ScrollView(.horizontal,showsIndicators: false) {
  //your code
  }

Show Indicators in ScrollView SwiftUI

 ScrollView(.horizontal,showsIndicators: true) {
  //your code
  }
Chithian
  • 253
  • 3
  • 8