99#if os(iOS)
1010import SwiftUI
1111
12- /// This group applies zero insets and a clear background to render buttons in the
13- /// content as a horizontal group.
14- ///
15- /// You can style the view with `.listButtonGroupStyle(...)`.
12+ @available ( * , deprecated, renamed: " ListActionButtonGroup " )
1613public struct ListButtonGroup < Content: View > : View {
1714
1815 /// Create a form button group section.
@@ -39,72 +36,4 @@ public struct ListButtonGroup<Content: View>: View {
3936 . listRowBackground ( Color . clear)
4037 }
4138}
42-
43- #Preview {
44-
45- struct PreviewList : View {
46-
47- var body : some View {
48- List {
49- " Add something " . previewButton ( . add)
50-
51- ListButtonGroup {
52- HStack {
53- " Bug " . previewButton ( . bug)
54- " Camera " . previewButton ( . camera) . disabled ( true )
55- " Photos " . previewButton ( . camera) . opacity ( 0.5 )
56- " Feedback " . previewButton ( . feedback)
57- }
58- }
59-
60- Section {
61- Text ( " Preview.Row " )
62- }
63- }
64- }
65- }
66-
67- return VStack ( spacing: 0 ) {
68- PreviewList ( )
69- Divider ( )
70- PreviewList ( )
71- . listButtonGroupStyle ( . swedish)
72- Divider ( )
73- PreviewList ( )
74- . environment ( \. colorScheme, . dark)
75- }
76- . frame ( maxHeight: . infinity)
77- . background ( Color . black. opacity ( 0.08 ) . ignoresSafeArea ( ) )
78- }
79-
80- private extension ButtonStyle where Self == ListButtonGroupStyle {
81-
82- static var swedish : Self {
83- . init(
84- backgroundColor: . blue,
85- labelStyle: . init( color: . yellow)
86- )
87- }
88- }
89-
90- @MainActor
91- private extension String {
92-
93- func previewButton( _ icon: Image ) -> some View {
94- Button { } label: { Label ( LocalizedStringKey ( self ) , icon) }
95- }
96- }
97-
98- private extension Image {
99-
100- static let add = systemImage ( " plus " )
101- static let bug = systemImage ( " ladybug " )
102- static let camera = systemImage ( " camera " )
103- static let feedback = systemImage ( " envelope " )
104- static let photoLibrary = systemImage ( " photo.on.rectangle.angled " )
105-
106- static func systemImage( _ name: String ) -> Image {
107- Image ( systemName: name)
108- }
109- }
11039#endif
0 commit comments