Joseph Quigley · @quigs
0 followers · 6 posts · Server iosdev.space

I know writing a custom NSMergePolicy is rarely needed, but if you do find you need to write one, Apple’s lack of documentation makes it nearly impossible to diagnose if you do it wrong. I wrote the missing documentation so you don’t have to flounder around like I did.

TLDR: Be sure to call super, or else it all falls apart. Not intuitive, but the base merge policy respects your changes.

quigs.blog/how-to-write-a-cust

#coredata #swiftdata #iOS #apple #developer #iosdev #documentation #blog #howto

Last updated 1 year ago

Axel Le Pennec · @alpennec
237 followers · 544 posts · Server iosdev.space

Asking for a friend: how would you model your /#SwiftData schema for an activity feed with different types of activities (like a log of events where each events can have its own attributes)? Objects would be used in a List + FetchRequest for example.

1. Inheritance? I’m a bit worried about performance/evolution issues as one single table will store all properties.
2. Common Entity with properties shared by all events (like timestamp) related to all events?
3. Something else?

#coredata

Last updated 1 year ago

Jaanus Kase · @jaanus
336 followers · 2 posts · Server iosdev.space

I’m on Mastodon for two things.

I build things on Apple platforms. I make @tact. I read (a lot) and post (a little) about related technologies: , , , , , , , as well as product design.

I support Ukraine. I follow Ukrainians and friends of 🇺🇦. Please donate to 🇺🇦 until 🗑🇷🇺 is gone: u24.gov.ua or any other respected charity. My Twitter is mostly about Ukraine - twitter.com/jaanus

#introduction #swift #swiftui #Combine #cloudkit #coredata #xcode #concurrency

Last updated 1 year ago

Axel Le Pennec · @alpennec
236 followers · 536 posts · Server iosdev.space

I think it's time to say goodbye to some Objective-C code from 2013. I used NSKeyedUnarchiver at that time, and switch to many years ago.

#coredata #indiedev #BuildInPublic

Last updated 1 year ago

Axel Le Pennec · @alpennec
231 followers · 528 posts · Server iosdev.space

So many reasons to target iOS 17+ & drop support for older versions:
- MapKit for (annotations & overlays)
- now supports live updates using Swift concurrency’s async/await capability
- (no, just a joke, I'll stick to my stack for now)

#swiftui #corelocation #swiftdata #coredata

Last updated 1 year ago

Axel Le Pennec · @alpennec
230 followers · 527 posts · Server iosdev.space

@MakeAppPie oh! It comes from where description cannot be used for an attribute name in an entity.

#coredata

Last updated 1 year ago

Axel Le Pennec · @alpennec
218 followers · 477 posts · Server iosdev.space

Has anyone built an app with sharing where participants needs to link their CloudKit identity to a database Person entity object? Like a task management app with assignees join the project.

I was thinking about a flow with a "self-selection process" where participants select an existing Person from the database (or create a new one) when joining the share.

The app would then store the CKShare.currentUserParticipant.userIdentity.userRecordID as a field on the Person object.

#coredata #cloudkit

Last updated 1 year ago

Jonathan · @JTostitos
170 followers · 441 posts · Server techhub.social

Anyone have any experience putting their SwiftUI PersistenceController, CoreData xcdadamodeld file, and NSManagedObject Subclasses in a 📦 Swift Package?

Im getting this crash as soon as I moved it into a package. Any ideas why that might be? (Yes, I know I’m force unwrapping a few things 🙈. Any suggestion to improve this or fix this error would be appreciated 🙂)

#swiftui #coredata #spm

Last updated 1 year ago

Axel Le Pennec · @alpennec
209 followers · 419 posts · Server iosdev.space

@matt1corey hey Matt. I’m digging a bit more into Sharing (with & ). I know you implemented sharing in your apps.

In an app where I want to attribute an event to a specific user, how would you do that? E.g. a task management app with assignee and assignees can be added by sharing to them. I want to track who created/edited/completed a task for example (like a log of events/activities). Should I add the userRecordName in the object?

#cloudkit #coredata #nspersistentcloudkitcontainer

Last updated 1 year ago

Gavin Jones · @gavtron
10 followers · 42 posts · Server mstdn.social

Hey, (re) time!
I’m the creator/developer of CardBoard: boardgame scoring app. I launched in the very early days of , using lots of , and . For v2 I’m doing a complete rewrite: moving to iOS 17 and . I’m building in public for those who want to follow the journey and learn with me!

#swiftdata #coredata #CloudKit #combine #SwiftUI #Introduction

Last updated 1 year ago

How tf are you supposed to make a selectable list in SwiftUI using IDs in the selection state? SwiftData does this fairly effortlessly, but I had to convert to CoreData (because SwiftData stupidly isn’t backported to previous iOS versions), and despite compiling, selection doesn't actually work.

I can’t find any good examples of how to do this online, and the few I find use the entire object for selection, rather than just the IDs.

SwiftData uses MyEnttiy.ID, which exists in CoreData (NSManagedObject conforms to Identifiable), but that doesn’t appear to be a type I can use to fetch an object from NSManagedObjectContext.

#swiftui #coredata

Last updated 1 year ago

Axel Le Pennec · @alpennec
197 followers · 362 posts · Server iosdev.space

The app is 💯 built in .

is used for local data persistency and is used to sync data between devices (both user content & preferences).

is used to process and manage auto-renewable subscriptions.

#swiftui #coredata #cloudkit #RevenueCat

Last updated 1 year ago

thatvirtualboy · @thatvirtualboy
102 followers · 497 posts · Server techhub.social

Is anyone else using noticing ghost objects appearing in their datasets when deleting objects on ?

#coredata #ios17 #iosdev #swift #swiftui

Last updated 1 year ago

It is bonkers to me how absolutely stupid Core Data can be. You can't make await calls inside the async perform block, and you can't pass back the object you want and access it outside the perform block. So you have to pass it as a dictionary, or marshal it into some other “safe” type. And then you have to create another perform block later, *and fetch it again*, to update it.

And the WWDC presenters are so proud of these limitations.

#iOS #swift #coredata

Last updated 1 year ago

Trying to write SwiftUI code to edit a Core Data entity, and wow, it is hard to do! Seems impossible to do elegantly. I hope SwiftData is better.

But yeah, it seems you *must* create a bindable @State property for each property of your entity you want to be able to edit in your UI, set them all in .onAppear(), and then update the entity on save, or on a bunch of .onChange(of:) handlers.

Makes it particularly difficult to separate the details of the form from a simpler parent that handles setting up and saving or discarding (and confirming with the user if they want to discard).

Since Core Data properties must be optional, you can’t bind to them directly. Although optionality generally complicates SwiftUI primitives anyway.

#iOS #macos #swift #swiftui #coredata #xcode

Last updated 1 year ago

Nikhil Nigade · @nikhil
190 followers · 1432 posts · Server social.dezinezync.com

I'm used to defining Models in using their code based approach. I do not like it, but it's my only option so I deal with it.

For , I can use the GUI to define models and setup relationships. I'm very much used to this. The graph view makes it trivial to visualise relationships across models.

completely disregards this and requires defining models in code. Makes visualising or getting an overview of relationships across models non-trivial.

#vapor #coredata #swiftdata

Last updated 1 year ago

Jaanus Kase · @jaanus
353 followers · 591 posts · Server mastodon.justtact.com

Can anyone more familiar with above topics help me understand what’s going on here?

I thought that NotificationCenter Combine-based and AsyncSequence-based API-s behave exactly the same. Now I hit a case where they don’t. Their behavior differs based on whether I give it the sending object or not.

Why?

#swift #coredata #combine #concurrency #asyncsequence #notificationcenter

Last updated 1 year ago

Roman Lefebvre · @rlfb
377 followers · 481 posts · Server mastodon.design

@brandonhorst isn’t supposed to be compatible with ? Could you mix and match?

#coredata #swiftdata

Last updated 1 year ago

Keith Harrison :clubtwit: · @kharrison
675 followers · 197 posts · Server twit.social

Notes from my WWDC23 Core Data lab, mostly about CloudKit sync but touching on SwiftData and a few other things useyourloaf.com/blog/wwdc23-co

#wwdc23 #coredata

Last updated 1 year ago

Stewart Lynch · @StewartLynch
999 followers · 596 posts · Server iosdev.space

@SwiftData is really nice to work with compared to , but there are a lot of things you still have to be aware of. Looking forward to new books from @donnywals and Mark Moeykens (Big Mountain Studio). I am going on my annual wine tour/purchase during @twostraws Hacking with Swift Live, but I am going to sign up anyway just to get the videos and make sure I have everything covered.

#coredata

Last updated 1 year ago