A SwiftUI ScrollView that only scrolls if the content doesn't fit in the View
Requirements iOS 13+
- In Xcode, open your project and navigate to File → Swift Packages → Add Package Dependency.
 - Paste the repository URL (https://github.com/dkk/ScrollViewIfNeeded) and click Next.
 - For Rules, select version.
 - Click Finish.
 
.package(url: "https://github.com/dkk/ScrollViewIfNeeded", .upToNextMajor(from: "1.0.0"))Copy /Sources/ScrollViewIfNeeded/ScrollViewIfNeeded.swift into your project
Import the ScrollViewIfNeeded package to your view:
import ScrollViewIfNeededuse it like you would use ScrollView:
ScrollViewIfNeeded {
    /* your content */
}configure it the same way you would configure ScrollView:
ScrollViewIfNeeded(.horizontal, showsIndicators: false) {
    /* your content */
}or use it as a ViewModifier:
/* your view */
    .makeScrollableIfNeeded(.horizontal)You can contribute to this project by helping me solve any reported issues or feature requests and creating a pull request.
If you just want to say thanks, you could buy me a coffee ☕️.
ScrollViewIfNeeded is released under the MIT License.