Post

Replies

Boosts

Views

Activity

Reply to SwiftData: Unable to delete (Xcode 16)
Here's the entire code: import SwiftData struct ChatHistory: View { @Environment(\.modelContext) var modelContext // Sort SwiftData list by DATE: @Query(sort: \SwiftDatabase.date, order: .reverse, animation: .spring) private var chatLog: [SwiftDatabase] @Environment(\.dismiss) var dismiss @State private var actTxt: String = "" @State private var btnDel = false var body: some View { PullDownToDismiss() NavigationStack { List { ForEach(chatLog) { show in HStack { // Show Date of Chat: Text("\(show.date.formatted(date: .numeric, time: .omitted))") .foregroundStyle(Color.init(uiColor: .secondaryLabel)) .font(.system(size: 18, weight: .regular)) Text("\(show.actTxt ?? "----")") .foregroundStyle(Color.init(uiColor: .label)) .font(.system(size: 22, weight: .bold)) .navigationTitle("Chat Log") .navigationBarTitleDisplayMode(.inline) .swipeActions(allowsFullSwipe: true) { Button("Delete", systemImage: "trash", role: .destructive) { } } } }.onDelete(perform: deleteLog) } } } public func deleteLog(_ indexSet: IndexSet) { for index in indexSet { let chat = chatLog[index] modelContext.delete(chat) // do { // try modelContext.save() // // } catch { // // print("Error saving: \(error)") // // } } } }
Jun ’24
Reply to SwiftUI: Extra line in NavigationStack
The 2 NavigationTitles are for the listView and then the DetaiView. The data.name is coming from an array thats in another Swift file. Its where the information is coming from. I did not know about pasting code with the Paste and Match style. I'll remember that for the next time. Here's a screen shot of the previous screen before the original one. Thanks.
Dec ’22
Reply to How to replace existing app?
All I did was, make the new app and used the same Bundle Identifier inside the new app. I then made a pop-up (that would only come up once) explaining the new (designed) app. Less confusion for the end user. Which, in my experience, they don't take too likely when they have to download another app and re-pay for some of the same functionality. Dan Uff
Apr ’22