89

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.

5 Answers 5

197

You can use showsIndicators: false to hide the indicator:

ScrollView(showsIndicators: false) {
    // ...
}
Sign up to request clarification or add additional context in comments.

Comments

9

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 (this is link to better introspect, as original introspect now is unsupportable):

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

as result:

  • horisontal scroller invisible
  • vertical scroller visible;

Comments

8

From iOS 16, you can use:

ScrollView {
    ...
}
.scrollIndicators(.hidden)

Comments

7

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.

Comments

1

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
  }

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.