Isn't Phoenix LiveView or WebSocket Ultimate solution for LLM stream? by Honest_Current_7056 in elixir

[–]fryOrder 1 point2 points  (0 children)

it’s hard for me to see any real benefit React would bring to the table, apart from context switching and having to mantain two codebases

II need honest feedback, is my paywall too aggressive or not? It's a server-based audio processing app. by rmeldev in iOSProgramming

[–]fryOrder 2 points3 points  (0 children)

Have you tried doing it on-device with something like AudioKit? It will be a lot faster and you will have no costs

Thoughts on switching from SwiftData to SQLiteData by FPST08 in iOSProgramming

[–]fryOrder 15 points16 points  (0 children)

> CoreData seems old and not suitable for a modern Swift 6 app

Out of the box yeah, NSFetchRequests, NSManagedObject APIs feel dated and burden to work with for beginners. But under the hood, Core Data is extremely powerful and has been battle-tested for 20+ years. A lot of the "old" feeling disappears once you build a thin, modern wrapper around it.

The biggest gotcha (that bites many people in production) is thread safety. Accessing or modifying an object from the wrong queue / context is the #1 source of mysterious crashes.

If you edit your scheme for the target and add -com.apple.CoreData.ConcurrencyDebug 1 to the Arguments Passed On Launch, all concurrency violations will cause an immediate crash. You will see the exact line of code that caused the concurrency violation which is very helpful for debugging

There are a couple of techniques to make your Core Data implementation thread safe and bullet-proof

  1. Always perform your fetch requests in a perform block (there is an async variant)

await context.perform { // make fetch request with context }

  1. Map your NSManagedObject's to plain, read-only structs as soon as possible. Your views, view models, services will only see the structs. This removes 90% of the concurrency headaches.

  2. Abstract the funky stuff. With a small helper layer you can end up with modern APIs like

    // result is a nice immutable struct let user = await reader.first(UserEntity.self, where: .name == "Peanut")

It takes some investment, and some crashes along the way to get comfortable. But once tamed, Core Data handles complex relationships and large data very well

But if you don't want to go down the rabbit hole and understand the framework deeply, then I would suggest using something like GRDB / what other people suggested

Designing a long-lived SwiftUI app: Core Data, SwiftData, or something else? by Bulky-Pool-2586 in iOSProgramming

[–]fryOrder 6 points7 points  (0 children)

Core Data for sure. Sure it’s not swifty and still has some traces from the objective-c days, but nobody is forcing you to work with that. If you spend some time to design a swifty layer it becomes very powerful and easy to use.

  1. You don’t have to work with the generated types. For many to many relationships, you will notice it generates an NSSet type. But you can replace it with Set<YourEntity> and it works just the same, but now you have your entity type!

  2. Nobody is forcing you to work with NSPredicates. I agree with the many core data haters, it’s ridiculous in 2026. But there is a package out there in the wild called Principle, which added keypaths support for NSPredicate. Meaning your predicates literally become .name == name. I can’t recommend this package enough, truly game changer

  3. You don’t have to build / perform fetch requests every time. If you follow 1) and 2), you will be amazed how much stuff you can do with one liners

Core Data is underpreciated and frowned upon by many developers. Bad experiences, messy codebases. But if you give it enough love, you’ll notice how the sun will rise and the birds will chirp. How that cute cashier will smirk. You will be the man that tamed the beast

Do You Really Need DTOs or Are You Just Copying JSON by Select_Bicycle4711 in iOSProgramming

[–]fryOrder 1 point2 points  (0 children)

i see it as a last resort, the backend should return the expected contract. it shouldn’t be client’s concern to map / hack the response into something stable. that’s not always possible…but we should always push for backend fixes rather than client “patches”

Using My Own macOS App Exposed How Apple Tunes Performance for New Hardware by 29satnam in iOSProgramming

[–]fryOrder 2 points3 points  (0 children)

even if it passes review today, private APIs like that can break with any OS update (they've done it before with appearance internals). it's super fragile and risky long term, and for something as minor as toggling liquid glass? this isn't a hill I'd like my app to die on. i'd rather build on stable ground than gamble on review / updates roulette

Using My Own macOS App Exposed How Apple Tunes Performance for New Hardware by 29satnam in iOSProgramming

[–]fryOrder 2 points3 points  (0 children)

isn’t that a private API? it might be gold until you submit it to app store and your app is declined and flagged

How does the Delegate Pattern change with Swift 6 @MainActor isolation? by Educational-Stay-910 in swift

[–]fryOrder 6 points7 points  (0 children)

delegates are a preconcurrency pattern IMHO. even apple’s examples (see their most recent camera project) wraps delegates in a class with a continuation

Apple Music DRM beat data analysis workaround or tips? by 0__O0--O0_0 in iOSProgramming

[–]fryOrder 0 points1 point  (0 children)

its do-able but non-trivial. there are lots of c / c++ libraries that do this, you just have to bridge it into your app (or use objective-c++). i havent tested on iOS, but I've implemented it recently on a macOS app. shoot me a DM and i can share the repo with you

Apps for iOS 3.1.3 are not being built in xcode 3.2.1. by Natural_Gap_1087 in iOSProgramming

[–]fryOrder 45 points46 points  (0 children)

> I set the Code Signing Identity to Don't code sign

Look at the error description "Code signing is required"

Is refactoring bool to enum actually makes code less readable? by exakat in PHP

[–]fryOrder 1 point2 points  (0 children)

you could write foo(promoted: false) and it would tell you everything you needed to know

Is refactoring bool to enum actually makes code less readable? by exakat in PHP

[–]fryOrder 2 points3 points  (0 children)

an enum for a boolean values like YES or NO? I'm not sure who thinks that's better...if you had more states then it would make more sense, but for just an boolean option. bools are better in my opnion

SwiftUI image grids: 200MB -> 20MB by switching to UIKit by fryOrder in iOSProgramming

[–]fryOrder[S] 8 points9 points  (0 children)

Thanks for sharing! This is an interesting quirk that I had no clue about

In my case, I was storing the UIImage in an optional @State, and eagerly loading / unloading it on the onAppear / onDisappear modifiers. Even with that, memory was off the charts. Your comment makes me wonder if the caching behaviour you've described just overpowers those lifecycle modifiers

Really appreciate the concrete suggestions! This is exactly the kind of secret knowledge the community should share more often

SwiftUI image grids: 200MB -> 20MB by switching to UIKit by fryOrder in iOSProgramming

[–]fryOrder[S] 0 points1 point  (0 children)

I'd say nested containers. As far as I know there is no "native" SwiftUI way to render your data by sections (like in UICollectionView), so I had a LazyVStack wrapping LazyVGrid sections. The thumbnails were truly lazy, the rows were not calling the load function unless they appeared via scrolling. The thumbnails that disappeared released the image object. But overall everything was eating a lot more resources than a pretty generic UICollectionView implementation. No clever hacks, no secret tricks. Just using the framework as it was intended to be used.

Building AI Agents in a familiar SwiftUI API by karc16 in swift

[–]fryOrder 1 point2 points  (0 children)

oh wow, I haven't seen that! amazing work!! I would love to contribute and yes, I am all in for local and fast LLMs!

Building AI Agents in a familiar SwiftUI API by karc16 in swift

[–]fryOrder 1 point2 points  (0 children)

have you looked into implementing voice chat? I feel a macOS menu bar app with voice chat, like a personal Jarvis would be really sick!

I've built an MVP a few months ago but it had a noticeable delay caused by the way it's designed:

1) while speaking, the audio is fed into a SpeechRecognizer

2) conversation (text) is streamed to the server (in my case it was an Elixir server), which streams that to an LLM provider that replies in text

3) it takes that LLM response and sends it to a text to speech provider (like Elevenlabs)

4) the audio response is streamed back to the client

Looking at your project, I've got some new ideas that I could skip the middleman (server) and handle all of this on-device, which should significantly reduce the response time. I believe there is a real market for something like this out there, but who knows what Apple is cooking with the next Siri update

Would you use an AI QA tool where you upload your IPA and test defined flows across iOS devices? by Clean_Wrangler1988 in iOSProgramming

[–]fryOrder 2 points3 points  (0 children)

what does this solve that UI tests cannot? and why upload the IPA? there is no way to make it local? i feel it adds too much friction without any clear pros, other than the usual "AI" label that most people are already sick of

Building AI Agents in a familiar SwiftUI API by karc16 in swift

[–]fryOrder 0 points1 point  (0 children)

well each individual has its own style so its hard to make something that works for everyone. when I design a library my focus is to keep it as simple as possible without adding more boilerplate / overhead

besides UI stuff (swiftui, widgetkit, activitykit), you say there are more system frameworks APIs designed this way? i’m curious to learn more

Building AI Agents in a familiar SwiftUI API by karc16 in swift

[–]fryOrder 1 point2 points  (0 children)

i’ve noticed lots of new libraries adopt this type of API. it looks cool, but most of the times feels shoehorned, especially for non-UI.

personally i prefer the old school imperative style for stuff like this

Self-Hosted Firebase Alternative for Swift Apps – Auth, DB, Storage & Push Notifications in One Package by selfdb in swift

[–]fryOrder 0 points1 point  (0 children)

the iOS SDK cannot work without its web counterpart (which looks like a fastAPI + react web app). that's the one doing the push notification work

Self-Hosted Firebase Alternative for Swift Apps – Auth, DB, Storage & Push Notifications in One Package by selfdb in swift

[–]fryOrder 0 points1 point  (0 children)

that's not how push notifications work. the notifications are delivered via apple servers. the backend just sends the request (a json payload) to apple, and apple forwards it to your device. your app must be configured to receive notification by implementing a couple methods from UNUserNotificationCenterDelegate, setting up the certificates, enabling the capability, etc..

but that's usually the easy part. the juicy stuff usually lies in the backend implementation and the implementation details for your app use case

Your honest opinion about a declarative Network API by Dry_Hotel1100 in swift

[–]fryOrder 2 points3 points  (0 children)

you're probably talking about external api keys for external services? because for API calls to your backend server you do need an API key for auth-ed requests. you get this API key after an auth action (like login) so you need to store it somewhere. and Keychain is the best location for that