NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

SOLVED: Query on project approach. I would really like to hear your opinions

Forums > macOS

I have a MS Access database. My wife uses the db to track the work of British TV actors. Her windows laptop is old and I bought her a MacBook Air to replace it and now I need to make her favourite db work on her MacBook Air.

It comprises 14 Entities varying in size from 50 to 50,000 records. There is a mix of relationships

  • One to One
  • One to Many
  • And 2 pseudo Many to Many - via join tables The tables have automated integer IDs

I can easily export the MS Access data to CSV files.

My question is, how would you approach this problem?

I’m currently creating a MacOS App using Core Data but every time I start to think about the existing data it gives me a headache.

My options as I see it are:

  1. Continue with MacOS app using core data and import the existing data
  2. Continue with MacOS app but keeping the data in files as CSV or JSON
  3. Something else - maybe a web app?

I would very much appreciate your thoughts please.

   

What gives you a headache with Core Data? The modelling?

   

Hi @Hatsushira,

Thank you for your reply.

Yes the modelling. I'm not sure how to define the model in xcode so that it works with both the historic and new data. While I am still staring at a blank canvass, I thought I would ask the community for preferred approaches. Of course what I am hoping to do is to avoid many wasted hours of chasing wild geese :-D

Do you have any suggestions?

Thanks

   

Personally, I would go with Core Data. You get all functionality (no need to create your own database handler). Basically, you create your tables and attributes similiar to MS Access. Regarding relationships you set them in the relationships section of the entity. Make sure you have both directions set and the delete handling (nullify, cascade, deny, no action) according to your wish.

Many to many relationships don't need a join table unless you need to store additional data to the specific relationship. Then you create a join table with two 1-to-many relationships like you do in MS Access.

One major difference when setting a relationship for your concrete entity object you just assign the object, no ID handling in your code. IDs are managed from Core Data and under the hood the ID is saved not the whole object. You don't have access to the internal ID Core Data uses to manage the objects.

1      

Thanks. thats what I was hoping to hear :-)

   

Hacking with Swift is sponsored by NSSpain

SPONSORED Announcing NSSpain 2020: Remote Edition! An online, continuous conference for iOS developers. We’ll start on Thursday and finish on Friday, with talks, activities, and lots of fun for 36 hours, non-stop. Sound good? Join us!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

Not logged in

Log in
 

Link copied to your pasteboard.