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
872
Jul ’22
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
234
Apr ’22
Textfield foregroundColor not changing
I am using a Textfield control in my detail view. TextField("Title", text: self.$newReminderTitle).font(.title) However, the foregroundColor property is not applied to the default placeholder text that describes the name of the property (in this case "Title" is always shown in light gray) Is there a way to change this?
0
0
205
Sep ’20
Dropdown control in Swift UI
Is there a standard, generic way to implement a Swift UI dropdown for an iOS app? I've been searching the documentation and the only viable option appears to be the Picker, but I'd prefer to avoid it. I was able to find a walkthrough on how to make one from scratch using a set of button controls. Is this good practice or should I use the picker instead?
0
0
798
Sep ’20