mirror of
https://github.com/yattee/yattee.git
synced 2025-04-27 23:40:35 +05:30
Extract variable
This commit is contained in:
parent
800e306487
commit
ccc32c305c
@ -94,7 +94,7 @@ struct AddToPlaylistView: View {
|
|||||||
selectPlaylistButton
|
selectPlaylistButton
|
||||||
#else
|
#else
|
||||||
Picker("Playlist", selection: $selectedPlaylistID) {
|
Picker("Playlist", selection: $selectedPlaylistID) {
|
||||||
ForEach(model.all.filter(\.editable)) { playlist in
|
ForEach(editablePlaylists) { playlist in
|
||||||
Text(playlist.title).tag(playlist.id)
|
Text(playlist.title).tag(playlist.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,6 +111,10 @@ struct AddToPlaylistView: View {
|
|||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var editablePlaylists: [Playlist] {
|
||||||
|
model.all.filter(\.editable)
|
||||||
|
}
|
||||||
|
|
||||||
private var formAlignment: HorizontalAlignment {
|
private var formAlignment: HorizontalAlignment {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.trailing
|
.trailing
|
||||||
@ -139,10 +143,10 @@ struct AddToPlaylistView: View {
|
|||||||
return // swiftlint:disable:this implicit_return
|
return // swiftlint:disable:this implicit_return
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedPlaylistID = model.all.next(after: selectedPlaylist!)!.id
|
selectedPlaylistID = editablePlaylists.next(after: selectedPlaylist!)!.id
|
||||||
}
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
ForEach(model.all) { playlist in
|
ForEach(editablePlaylists) { playlist in
|
||||||
Button(playlist.title) {
|
Button(playlist.title) {
|
||||||
selectedPlaylistID = playlist.id
|
selectedPlaylistID = playlist.id
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user