I have an app with fairly typical requirements - I need to insert some data (in my case from the network but could be anything) and I want to do it in the background to keep the UI responsive.
I'm using SwiftData.
I've created a ModelActor that does the importing and using the debugger I can confirm that the data is indeed being inserted.
On the UI side, I'm using @Query and a SwiftUI List to display the data but what I am seeing is that @Query is not updating as the data is being inserted. I have to quit and re-launch the app in order for the data to appear, almost like the context running the UI isn't communicating with the context in the ModelActor.
I've included a barebones sample project. To reproduce the issue, tap the 'Background Insert' button. You'll see logs that show items being inserted but the UI is not showing any data.
I've tested on the just released iOS 18b3 seed (22A5307f).
The sample project is here:
https://hanchor.s3.amazonaws.com/misc/SwiftDataBackgroundV2.zip
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I've got an iOS framework that I've had around for ages. It's a mixture of Objective-C and Swift.
Since installing Xcode 12, I'm now getting a bunch of warnings of the type:
'Double-quoted include in framework header, expected angle-bracketed instead'
If I go to the various source files and say change:
#import "Place.h"
to
#import <VegasKit/Place.h>
then I get an error saying it can't find the file. If I try this:
#import <Place.h>
then I get an error telling me to go back to double-quotes, i.e. undo the change.
Any idea what I can do to get this all setup correctly? Thanks.
Today's Xcode release won't download the visionOS SDK, gives a 'network error'.
Topic:
Developer Tools & Services
SubTopic:
Xcode
I'm seeing a lot of these in my logs:
PersistentIdentifier PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: x-swiftdata://Course/BC9CF99A-DE6A-46F1-A18D-8034255A56D8), implementation: SwiftData.PersistentIdentifierImplementation) was remapped to a temporary identifier during save: PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: x-coredata:///Course/t58C849CD-D895-4773-BF53-3F63CF48935B210), implementation: SwiftData.PersistentIdentifierImplementation). This is a fatal logic error in DefaultStore
... though everything seems to work.
Does anyone know what this means in this context? Anything I can do to not have this appear?
I'm experimenting with using the Foundation Models framework to do news summarization in an RSS app but I'm finding that a lot of articles are getting kicked back with a vague message about guardrails.
This seems really common with political news but we're talking mainstream stuff, i.e. Politico, etc.
If the models are this restrictive, this will be tough to use. Is this intended?
FB17904424
Topic:
Machine Learning & AI
SubTopic:
Foundation Models
I'm playing with Shortcuts.Siri is telling me "There was a problem with the app" whenever I call the completion handler with a success message. My failure states work.I backed out my custom code and literally just returning static strings in my completion and I'm still getting the error. I'm not really sure how to debug this or where it's going wrong... I'm sending a correctly formed intent response.??
Foundation Models are driving me up the wall.
My use case: A news app - I want to summarize news articles. Sounds like a perfect use for the added-in-beta-5 "no guardrails" mode for text-to-text transformations...
... and it's true, I don't get guardrails exceptions anymore but now, the model itself frequently refuses to summarize stuff which in a way is even worse as I have to parse the output text to figure out if it failed instead of getting an exception. I mostly worked that out with my system instructions but still, the refusing to summarize makes it really tough to use.
I instructed the model to tell me why it failed if that happens.
Examples of various refusals for news articles from major sources:
"The article mentions "Visual Lookup" but does not provide details about how it integrates with iOS 26."
"The article includes unsafe content regarding a political figure's potential influence over the Federal Reserve board, which is against my guidelines."
"the article contains unsafe content."
"The article is biased and opinionated and focuses on the author's opinion."
(this is despite the instructions specifically asking for a neutral summary - I am asking it to not use bias in the output but it still refuses)
I have tons of these. Note that if I don't use the "no guardrails" mode and use a Generable instead, some of these work fine so right now I have to do two passes on much of the content since I never know which one will work.
Having a "summary mode" that often refuses to summarize current news articles (the world is not a great place, some of these stories are a bummer) is near worthless.
Has Apple made any commitment to versioning the Foundation Models on device? What if you build a feature that works great on 26.0 but they change the model or guardrails in 26.1 and it breaks your feature, is your only recourse filing Feedback or pulling the feature from the app? Will there be a way to specify a model version like in all of the server based LLM provider APIs? If not, sounds risky to build on.
Hi,
I'm trying to use Table in an app sort of similar to the garden example but imagine if there was a third view in the NavigationView for a third column.
And then imagine that if you selected a single plant in the middle table, a sort of detail inspector would appear in the third position with the data from your selection, updating as the selection in the middle table changed.
I'm struggling a bit to get this working. I've tried:
Wrapping the table column content closure's contents in a NavigationLink. This sort of works but it styles things oddly in the table column and as I scroll around, it seems to trigger on it's own, I'm guessing as cells are re-used or something behind the scenes. This feels wrong.
Moving row creation into the rows: parameter with TableRow but the only modifier there is for drag and drop, there's no onTapGesture or similar.
Watching for changes to the selected item via the binding and then acting on it then - this fires when I select stuff and I can get the related model object but I can't put a NavigationLink in there as it's outside of the view hierarchy so I'm not sure how to act on it.
I'm guessing there's some other way to handle this that I'm simply not thinking of but if anyone has any pointers, much appreciated!
So, using UIStackView, I've noticed that some UILabels seem to want to truncate instead of wrap to a new line... Anyone else noticed this? The label's number of lines is set to 0.There's a stack view with two labels in it. The stack view is setup to be horizontally and vertically centered in its superview with at least 10 points from the trailing and leading margins. I'd expect the labels to wrap to a new line, not truncate.Any thoughts?
Hi,I've got my CloudKit records with created and modifed setup to be sortable and queryable but I'm having a hard time constructing a CloudKit.js query that will use those values.This: var query = {
recordType: "MyRecord",
sortBy: [{
fieldName: 'created'
}]
};This doesn't work, I get this error:Unknown field 'CKFieldName{_name='created'}I also tried 'createdDate', 'modified', 'modificationDate' and all give the same error. What's the magic?
Is there a problem with an app having more than one widget extension?
I previously had two 'Today View' extensions that I'm replacing but after installing the app on device with two widget extensions, I'm only seeing the second one in the widget picker.
I see that there's WidgetBundle but my two widgets have very different datasets so the timeline stuff won't mesh.
I've implemented the imagePlaygroundSheet modifier in my app. It eventually all works but I've consistently noticed that the first time I present it, the sheet is totally blank. I then have to pull down to dismiss it (it doesn't even have a cancel button) and present it a second time and it loads content.
Just me? This is on 18.2 final, iPhone 16 Pro Max.
Topic:
Machine Learning & AI
SubTopic:
Apple Intelligence
Trying the Foundation Model framework and when I try to run several sessions in a loop, I'm getting a thrown error that I'm hitting a rate limit.
Are these rate limits documented? What's the best practice here?
I'm trying to run the models against new content downloaded from a web service where I might get ~200 items in a given download. They're relatively small but there can be that many that want to be processed in a loop.
Topic:
Machine Learning & AI
SubTopic:
Foundation Models
I'm trying CoreSpotlight on the 18b1 seed on iOS and after submitting my query, I'm getting multiple errors about what looks like missing models:
[Model loading] model loading failed with err -1000 for model path /Users/hunter/Library/Developer/CoreSimulator/Devices/0AF4F46E-5510-4458-B61C-F8A153155809/data/Containers/Data/Application/1D8580C0-AC80-4949-9FDA-31DB463BDA5C/Library/Spotlight/Resources_V3/Default/models/spotlight_l2.mlmodelc and directives path /Users/hunter/Library/Developer/CoreSimulator/Devices/0AF4F46E-5510-4458-B61C-F8A153155809/data/Containers/Data/Application/1D8580C0-AC80-4949-9FDA-31DB463BDA5C/Library/Spotlight/Resources_V3/Default/directives/directives_l2.mdplist
I am calling CSUserQuery.prepare() but that doesn't seem to make a difference.
Is there more to this than what is on this page? https://developer.apple.com/documentation/corespotlight/building-a-search-interface-for-your-app?changes=latest_minor