I have a simple detail view where users can input data. After pressing the save button, I would like the app to navigate back to the previous list view. The detail view is opened through a NavigationLink. I assume the action for the button needs to be adjusted in some way. Any advice is appreciated.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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?
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?
I have a simple View to retrieve User Input. I would like my TextField to span multiple lines. Any help is appreciated.
TextField("Content", text: $updatedReminderContent)
.onAppear {
self.updatedReminderContent = self.reminder.content!
}
}
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!)
}
}
}
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.