Skip to content

Commit 73d3fba

Browse files
authored
Use native list creation (#1176)
1 parent 5dc15fa commit 73d3fba

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

Diff for: Demo/Sources/Players/PlaybackView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ private struct AdaptiveSheetContainer<Content, Sheet>: View where Content: View,
791791
}
792792

793793
private func toolbarContent() -> some ToolbarContent {
794-
ToolbarItem(placement: .topBarLeading) {
794+
ToolbarItem(placement: .cancellationAction) {
795795
Button("Hide", action: close)
796796
}
797797
}

Diff for: Demo/Sources/Showcase/Playlist/PlaylistSelectionView.swift

+13-17
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,21 @@ struct PlaylistSelectionView: View {
4747
@Environment(\.dismiss) private var dismiss
4848

4949
var body: some View {
50-
NavigationView {
51-
List(selection: $selectedMedias) {
52-
ForEach(Self.medias, id: \.self) { media in
53-
Text(media.title)
54-
}
55-
}
56-
.environment(\.editMode, .constant(.active))
57-
.navigationBarTitle("Add content")
50+
List(Self.medias, id: \.self, selection: $selectedMedias) { media in
51+
Text(media.title)
52+
}
53+
.environment(\.editMode, .constant(.active))
54+
.navigationBarTitle("Add content")
5855
#if os(iOS)
59-
.navigationBarTitleDisplayMode(.inline)
56+
.navigationBarTitleDisplayMode(.inline)
6057
#endif
61-
.toolbar {
62-
ToolbarItem(placement: .navigationBarLeading) {
63-
Button("Cancel", action: cancel)
64-
}
65-
ToolbarItem(placement: .navigationBarTrailing) {
66-
Button("Add", action: add)
67-
.disabled(selectedMedias.isEmpty)
68-
}
58+
.toolbar {
59+
ToolbarItem(placement: .cancellationAction) {
60+
Button("Cancel", action: cancel)
61+
}
62+
ToolbarItem(placement: .confirmationAction) {
63+
Button("Add", action: add)
64+
.disabled(selectedMedias.isEmpty)
6965
}
7066
}
7167
.tracked(name: "selection", levels: ["playlist"])

Diff for: Demo/Sources/Showcase/Playlist/PlaylistView.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ private struct Toolbar: View {
6161
}
6262
.padding()
6363
.sheet(isPresented: $isSelectionPresented) {
64-
PlaylistSelectionView(model: model)
64+
NavigationStack {
65+
PlaylistSelectionView(model: model)
66+
}
6567
}
6668
}
6769

0 commit comments

Comments
 (0)