Glad to see I'm not the only one. Thank you!
Post
Replies
Boosts
Views
Activity
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)")
//
// }
}
}
}
Sorry, here it is:
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.
You can only do that once a year after your membership renews.
Dan Uff
Try this:
Close Xcode.
Reboot the Mac.
Reload Xcode.
Reload project.
BUT before trying to run it, clear project files. If it still shows red files, look for those files manually in the Finder or recreate them.
Dan Uff
Logon to YouTube. There are plenty of videos on the correct way to do JSON in Swift.
[https://www.youtube.com/results?search_query=json+and+swift)
I've figured it out. Thanks.
How I read the WeatherKit docs., the Weather Logo must come from the attribution URL, and be on the main view controller period. No other way to do it.
But I am even having problems getting that far.
Dan Uff
Hi,
I too have had problems with the master/detail view of Swift and SwiftUI. But the below video has helped me a great deal.
https://youtu.be/nA6Jo6YnL9g
Hope this helps.
Hi,
If you're using storyboards, it means you don't have that IBOutlet connected to an object (such as a label, text, etc) in the storyboard.
Hope this helps,
Dan Uff
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
The way I understand it, they are only to be used in code. Also, if you use an Apple-specific symbol (such as the iCloud symbol) it can only be used as a representation of an iCloud function.
Dan Uff
Would you have any idea why this is happening to ME?
There is a hack that allows someone to show a message on the login screen, and maybe he/she just put it there to scare the pants off of you.
Do an internet search for how to add a message to the login screen and get rid of it. Besides, if the NSA was monitoring you, why would they TELL you?
Dan Uff