2024-04-02 15:56:32 -05:00

24 lines
570 B
Swift

import SwiftUI
// MARK: - ScrollViewModifier
/// A modifier that adds padded content to a `ScrollView`.
///
struct ScrollViewModifier: ViewModifier {
// MARK: Properties
/// Whether or not to add the vertical padding.
var addVerticalPadding = true
// MARK: View
func body(content: Content) -> some View {
ScrollView {
content
.padding(.horizontal, 16)
.padding([.top, .bottom], addVerticalPadding ? 16 : 0)
}
.background(Color(asset: Asset.Colors.backgroundSecondary))
}
}