Post

Replies

Boosts

Views

Activity

SwiftData multiple selection from sidebar
Hello, I am developing a swift data macOS reminders app. I need the user to be able to select multiple items from the sidebar and record a variable of which ones are selected. However, I also want a variable that will track the first one of the selection selected so it can be shown in the detail view. I would like this to be similar to the Apple reminders app, where u can select multiple to delete, but only one list is shown in the detail view. how do I do this? thanks so much, Dev_Pro
0
1
269
Jul ’24
Reorder multiple items in list - SwiftUI
Hello, I am unable to move multiple rows in a list, it only allows for one at a time. However, I am able to select multiple rows. Here is my code: import SwiftUI struct ContentView: View { @State var items = ["Test 1", "Test 2", "Test 3", "Test 4", "Test 5", "Test 6"] @State var selectedItems: Set<String> = .init() var body: some View { NavigationView { List(selection: $selectedItems) { ForEach(items, id: \.self) { item in Text(item).tag(item) } .onMove(perform: { indices, newOffset in withAnimation { self.items.move(fromOffsets: indices, toOffset: newOffset) } }) } #if os(iOS) .navigationBarItems(trailing: EditButton()) #endif } .padding() } } I need all the selected rows to move when dragged. Any help would be greatly appreciated, I have tried, and can not find any way to do it. Thanks, Dev_101
4
0
617
Mar ’24
SwiftUI Emoji Picker - MacOS
Hello, I am developing a multi-platform app, and I need an emoji picker. It should be the same as the emoji selection view in the Reminders App. Reminders App Image: (A button; when pressed calls the MacOS emoji selector, and the emoji selected is linked to a variable). I know you can call the EmojiSelector with NSApp.orderFrontCharacterPalette($variable) However, it only records the variable if you have a working text field linked to the variable. Then, if you edit the text field you can select more than 1 character, a non-emoji, and the emoji popover is not shown under the button. How do I make an emoji selector like the one above. Does it require a textfield for the selected emoji to be linked to a variable. If it does, can the text field be: Not Viewable and in a ZStack under the button Only editable by the emoji selector Replace the current emoji when another is selected Sorry if my question is lengthy. I have everything else in my app ready, and want to release it to the app store (it will be free). Thank you for any help, Dev_Pro
0
3
952
Jan ’24