Hey there, I don't know if you've solved your issue, but this was a major problem for me that took some time to work out. For anyone else who runs into this problem, maybe consider this solution.
What I did was manually write JSON format arrays and dictionaries to put labels for each token (singular word that makes up a sentence - image you take your input sentence and say textString.split(by: " ") (by space))
What really sped things up was bringing chat gpt in. It took awhile to teach it what I needed to do, but you can get it to spit out correct format json after giving it around 15-20 items you've written manually.
Here's the format:
[
{
"tokens": ["Remind", "me", "tomorrow", "at", "8", "am", "to", "leave", "for", "work"],
"labels": ["NONE", "NONE", "TIME", "TIME", "TIME", "TIME", "NONE", "REMINDER", "REMINDER", "REMINDER"]
},
{
"tokens": ["Set", "a", "reminder", "next", "tuesday", "to", "buy", "a", "large", "ruler"],
"labels": ["NONE", "NONE", "NONE", "TIME", "TIME", "NONE", "REMINDER", "REMINDER", "REMINDER", "REMINDER"]
}
]
Each word in the "tokens" array lines up with a label in the "labels" array. The ml model, whence you successfully train it, will take in a sentence and spit out an array of labels that you can do a lot of things with.. that's another discussion.
Hope this helps,
roroDevelopment
Post
Replies
Boosts
Views
Activity
Ok sorry for the late reply, Ill send you the code soon because I’m not near my computer right now.
Can't you just save the time when the timer started to core data or something and on app reopen fetch that and calculate time since for timer? That seems like an easier way.
And if you ever need to use the timer in background you can always fetch the date and calculate the difference fairly easily.
Technically it can, using ForEach method calling in data from a server or algorithm (or whatever your data source is). Just create a cell view to handle the data and present to user.
import swiftUI
struct contentView: View {
@State var infiniteDataSource: DataSourceType
var body: some View {
ScrollView {
ForEach(infiniteDataSource) { data in
cellView(data: data)
}
}
}
struct cellView: View {
let data : DataSourceType //from top of content view
var body : some View {
Text("\(data.textStuff)")
// include whatever other content you want to show, configure this view to your liking
}
}
For the sake of time I didn't configure the data model because I'm guessing you've done that already, but this would be an efficient way of infinite scroll in swiftUI using ForEach in data source.
I hope that works,
roroCoder
I wouldn't use @ObservedObject for passing variables of type ItemGroup entity especially since all of the data is stored in the Core data model. Just pass around the data through view hierarchy with @Binding or no property wrapper. Honestly haven't seen a difference in performance when I did that in my app, but it makes more sense not to use ObservedObject property wrapper when you are not accessing an observable object class.
Hope that makes sense.
I have macOS Catalina, and now I am trying to update from Xcode 12.4 to 12.5, but I'm getting an error saying I need macOS Big Sur. How is it possible I got Xcode 12.4 then? Or has something been changed. This is quite annoying because I have a high-end iMac that is too old for Big Sur, but powerful enough to handle large apps and compiling.
Is this just me, or are other people facing this problem as well?
Thank you,
Can someone please explain how you edit a core data entry/record please. Thank you, I am having lots of trouble figuring it out.
How do you update the data is my question, I'm still trying to figure that out. I have the UUID of the entry, but I can't enter that into a fetch request to then delete that record? How did you manage to update the code?
Thank you, but when I try and put startOfDay into a Core Data Fetch Request as a Predicate format I get an error saying something about can't use initializers. Do you know how to solve this. Thank you so much for your help already.
Also if possible how would I be able to do the same thing for a tomorrow based on today from Date().
var today = Date()
/*code to get beginning and end of current Date()
Using the beginning of today add time interval: 86400 like below and then get start. From end of today do samething to get end of tomorrow. */
var tomorrow = Date(addingTimeInterval: 86400)
I just can't figure out what the code is to get the Start and End of Today. Also, how would you implement these two times into Predicate during Fetch Request.