Anjana Agrawal
Anjana Agrawal

Reputation: 31

SWIFTUI:- Is there any way to turn off bouncing while scrolling the scrollview?

I created an application in SwiftUI and use vertical scrolling. I want to turn off bouncing while scrolling the scroll view. How can I achieve this?

Upvotes: 3

Views: 1795

Answers (2)

Prasanth
Prasanth

Reputation: 676

I was able to turn off bounce for a SwiftUI list by turning off tableview bounce in the init(). I haven't tested it for scrollview but maybe you can do something similar?

init() {
    UITableView.appearance().bounces = false
}

Upvotes: 1

Nabeel Nazir
Nabeel Nazir

Reputation: 430

You cannot simply restrict scrollView's bounce, but you can achieve this by UIScollView's property.

 UIScrollView.appearance().bounces = false 

Add this in App-delegate or View's initialiser method. Hope This will help you.

Upvotes: 0

Related Questions