From ebd3797d7822487fa0bac68d8fd1c28d173280ee Mon Sep 17 00:00:00 2001 From: david-swift Date: Sun, 5 Jan 2025 13:31:16 +0100 Subject: [PATCH] Add option to hide the scroll indicators --- Sources/Core/View/ScrollView.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/Core/View/ScrollView.swift b/Sources/Core/View/ScrollView.swift index 769851c..5ca9461 100644 --- a/Sources/Core/View/ScrollView.swift +++ b/Sources/Core/View/ScrollView.swift @@ -14,6 +14,8 @@ public struct ScrollView: SwiftUIWidget { var axes: Set /// 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 } } }