From e3f735e2467a9a652f3702d3ef117f5fa085c287 Mon Sep 17 00:00:00 2001 From: Daniel Saidi Date: Tue, 30 Apr 2024 12:20:06 +0200 Subject: [PATCH] Add standard button type --- Sources/SwiftUIKit/Buttons/Button+Standard.swift | 4 ++-- Sources/SwiftUIKit/Lists/ListShelfSection.swift | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Sources/SwiftUIKit/Buttons/Button+Standard.swift b/Sources/SwiftUIKit/Buttons/Button+Standard.swift index c5e6a05b8f..3b2286207c 100644 --- a/Sources/SwiftUIKit/Buttons/Button+Standard.swift +++ b/Sources/SwiftUIKit/Buttons/Button+Standard.swift @@ -10,7 +10,7 @@ import SwiftUI public extension Button { - /// This is a standard add button. + /// Create a new ``StandardType``-based button. init( _ type: StandardType, _ title: LocalizedStringKey? = nil, @@ -42,7 +42,7 @@ public extension Button { public extension Button.StandardType { - var id: String{ rawValue } + var id: String { rawValue } var image: Image? { guard let imageName else { return nil } diff --git a/Sources/SwiftUIKit/Lists/ListShelfSection.swift b/Sources/SwiftUIKit/Lists/ListShelfSection.swift index 15becd6a38..058df85bb0 100644 --- a/Sources/SwiftUIKit/Lists/ListShelfSection.swift +++ b/Sources/SwiftUIKit/Lists/ListShelfSection.swift @@ -61,8 +61,12 @@ public struct ListShelfSection: View { struct PreviewSection: View { + func printText() { + print("Tapped") + } + func button(_ index: Int) -> some View { - Button(action: {}) { + Button(action: printText) { Text("Preview.Button.\(index)", bundle: .module) } }