Mike Apurin

@auramagi
178 Followers
266 Following
87 Posts
I make iOS apps.
Located in Kyoto, Japan.
Building @everyword
Blueskyhttps://bsky.app/profile/auramagi.bsky.social
GitHubhttps://github.com/auramagi
Blog (rarely active)https://apurin.me
@fatbobman @helge Admittedly, I stopped looking into Swift Data because it was not able to replicate my CoreData setup, so I'm not as familiar. I'll check out the repo, thanks.
@helge @fatbobman It's muddled because MOC is the object that performs queue synchronization and the object that runs queries. The first part is thread-safe, the latter isn't.
SwiftData splits the first part to an actor, so it can be more declarative with sendability.
@helge @fatbobman The context object itself is explicitly thread-safe, so it should have been Sendable all along. The unsafe part is the objects you get from it, and they are isolated by the perform methods.
I think of it similar to e.g. passing DispatchQueue between threads.

@alpennec I'd just rebuild without calculating insets manually.
Hide/unhide with opacity (to keep height consistent) title when the visibility changes.
ScrollView { }.safeAreaInset(edge: .top) { top }

onScrollVisibilityChange on the title inside the scroll to detect when it is off-screen.

@nicoreese @its_john_davis Yeah, the bordered style applies more padding horizontally than vertically and is not smart enough to adjust it. Circle shape here is fitted to height, but the size still stays rectangular and will have visible leading/trailing padding.
@alpennec Your scroll view touches the top safe area when the header is hidden, and is extending its size to cover it. It stops touching it when you show the header, shrinks, and the offset inside changes.
You can check by adding a consistent padding between top and scroll view.

New Blog Post: Let's Write a Train Tracking Algorithm

https://twocentstudios.com/2025/09/22/lets-write-a-train-tracking-algorithm/

A deconstructed version of my presentation from #iosdc 2025 in English. I walk through the creation of the algorithm behind Eki Live, an #iOS app that automatically detects the railway and next station for a train you're riding and updates the Dynamic Island.

Let's Write a Train Tracking Algorithm

The views do seem to get an update, but it happens *before* the state is actually mutated, and they show the previous value.

This was wild to track down.
Some combination of UIViewControllerRepresentable, withTransaction, and if-available break SwiftUI Observation.

https://gist.github.com/auramagi/05c2f7db387513374d7bd91501b07edb

FB20312818

I don't imagine I’ll use the battery pack often, it's more of a travel thing.