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