Add option to hide the scroll indicators
All checks were successful
Deploy Docs / publish (push) Successful in 3m56s
SwiftLint / SwiftLint (push) Successful in 4s

This commit is contained in:
david-swift 2025-01-05 13:31:16 +01:00
parent f28e425f71
commit ebd3797d78

View File

@ -14,6 +14,8 @@ public struct ScrollView: SwiftUIWidget {
var axes: Set<Axis>
/// The view's content.
var content: Body
/// Whether to hide the scroll indicators.
var hideScrollIndicators = false
/// The wrapped views.
public var wrappedViews: [String: any Meta.AnyView] {
@ -34,6 +36,14 @@ public struct ScrollView: SwiftUIWidget {
SwiftUI.ScrollView(properties.axes.swiftUI) {
MacBackendView(.mainContent)
}
.scrollIndicators(properties.hideScrollIndicators ? .hidden : .automatic)
}
/// Whether to hide the scroll indicators.
/// - Parameter enabled: Whether the scroll indicators are hidden.
/// - Returns: The scroll view.
public func hideScrollIndicators(_ enabled: Bool = true) -> Self {
modify { $0.hideScrollIndicators = enabled }
}
}