Post

Replies

Boosts

Views

Activity

Use context menu to navigate to another view
I would like to use a context menu item to navigate into a different view. .contextMenu { Button { // Navigate to a view     } label: {     Label("Add to playlist", systemImage: "music.note.list") } } There are multiple items in the context menu. I have tried to wrap the button into a NavigationLink but there is no response when selecting the context menu item.
2
1
1.1k
Sep ’23
Deleted item reappears shortly
I have a list of songs in a queue, deleting a single item with a swipe in edit mode shows strange behavior. The item shortly reappears after deletion, then disappears again. .onDelete { indexSet in deleteQueueItemAt(indexSet: indexSet) } func deleteQueueItemAt(indexSet: IndexSet) { musicPlayer.perform { queue in var itemToRemove : MPMediaItem = MPMediaItem() indexSet.sorted(by: > ).forEach { (i) in itemToRemove = queue.items[i + 1] } for item in queue.items { if item.persistentID == itemToRemove.persistentID { queue.remove(item) } } } completionHandler: { queue, error in if error != nil { print(error!) } } }
1
0
347
Apr ’22
Use context menu to navigate to another view
I would like to use a context menu item to navigate into a different view. .contextMenu { Button { // Navigate to a view     } label: {     Label("Add to playlist", systemImage: "music.note.list") } } There are multiple items in the context menu. I have tried to wrap the button into a NavigationLink but there is no response when selecting the context menu item.
Replies
2
Boosts
1
Views
1.1k
Activity
Sep ’23
Deleted item reappears shortly
I have a list of songs in a queue, deleting a single item with a swipe in edit mode shows strange behavior. The item shortly reappears after deletion, then disappears again. .onDelete { indexSet in deleteQueueItemAt(indexSet: indexSet) } func deleteQueueItemAt(indexSet: IndexSet) { musicPlayer.perform { queue in var itemToRemove : MPMediaItem = MPMediaItem() indexSet.sorted(by: > ).forEach { (i) in itemToRemove = queue.items[i + 1] } for item in queue.items { if item.persistentID == itemToRemove.persistentID { queue.remove(item) } } } completionHandler: { queue, error in if error != nil { print(error!) } } }
Replies
1
Boosts
0
Views
347
Activity
Apr ’22