Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
SaTaMaS
Apr 18, 2003
Has anyone else started seeing incredibly long load times in UIKit based apps post iOS 16/XCode 14? All of a sudden our app is taking ~60 seconds to load if it doesn't just crash first. The error message we're getting is "UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems."
There's an Apple thread for the error message with no reliable solutions: https://developer.apple.com/forums/thread/714278

Adbot
ADBOT LOVES YOU

SaTaMaS
Apr 18, 2003

Ihmemies posted:

So I guess app development is hell in iOS side if you want something like:
- an alarm clock with custom ringtones, fade-in sound so the alarm sound stats quiet, increases over time.
- support for multiple simultaenous timers with custom names

Those were built-in in Google Clock, and are sorely missing from Apple's Clock.

There's probably third party apps that do those?
https://apps.apple.com/us/app/alarmy-alarm-clock-sleepsound/id1163786766
https://apps.apple.com/us/app/sleep-cycle-sleep-tracker/id320606217

SaTaMaS
Apr 18, 2003
Are there any LLMs that are more up to date for Swift than ChatGPT with its 2021 cutoff?

SaTaMaS
Apr 18, 2003
In Core Data I have the main ViewContext for everything view related, and all changes are copied to a background context where changes are synced with the server in order to not clog the main thread, and to keep syncing decoupled from view state. Is there any way to do something similar in SwiftData? It looks like in SwiftData, a new model context is spun off from a model container, changes are made in this new context, and then these changes are saved back into the container when ready, which is great for persisting locally, but not great for continually looking for data changes that need to be remotely synchronized.

SaTaMaS
Apr 18, 2003

Graniteman posted:

With SwiftData they gave us a type of class called a ModelActor for doing background work. It has its own special ModelContext which you use for that background work. I’ve made a couple in my current project and find it works fine, and when you save that background context you will get changes on the main actor that show up in the UI. I can point you to some example code when I’m at my desk in a day or so if you can’t find a good example. The syntax changed some during the betas fyi.

You should definitely using a model actor to perform your background data access and sync. I don’t offhand know the best way to use that to monitor for changes in the model context to trigger that background work. In Core Data I would subscribe to a notification. Maybe you can still do that since it’s using Core Data internally?

Side note: I really hate that their official recommendation for solving some SwiftData problems is “implement and maintain a compete parallel data storage stack in Core Data and use that to solve your problem.”

Some sample code would be awesome, but monitoring for changes is key, in Core Data I can listen for the ContextDidSaveNotification, copy the changes from the viewContext to the syncContext, then look at the objects associated with the notification, and for each endpoint I have there is an associated NSPredicate that when true means the object needs to be synchronized. For SwiftData I know there is a new query language but I'm not sure how to run queries on the set of changed objects from a save notification like I can in Core Data.

SaTaMaS fucked around with this message at 00:20 on Oct 18, 2023

SaTaMaS
Apr 18, 2003
I have an .overlay that appears when a @FetchRequest isn't nil. It works great but is there any way to animate the overlay appearing/disappearing without using withAnimation or a redundant @State var showOverlay? Just applying .animation and .transition using fetchRequest.first as the value doesn't seem to do anything.

SaTaMaS fucked around with this message at 22:14 on Dec 22, 2023

SaTaMaS
Apr 18, 2003

pokeyman posted:

I have no useful experience but from reading the docs I know FetchRequest has initializers that take an Animation or a Transition, do those do anything helpful?

Those are related to animating in and out the rows produced by the FetchRequest

Adbot
ADBOT LOVES YOU

SaTaMaS
Apr 18, 2003
It looks like the best approach is @State var item: FetchRequestItem? (.animation would also work but still requires the @State var)
code:
.onChange(of: fetchRequest.first) { newValue in
   withAnimation {
      self.item = newValue
   }
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply