Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:12:56+00:00 2026-06-17T19:12:56+00:00

I have a Core Data design problem, I’m new to it and I’m still

  • 0

I have a Core Data design problem, I’m new to it and I’m still studying the Apple guide.

I have two entities: “BOX” (attributes: name, color, orderingValue) and “CD” (only attribute: name).
It is a many – to many relationship.

On my hypotetical desk I can have many BOXes.

A BOX can contain many CDs. Copies of the same CD can be stored in different BOXes on the desk.

I sort the BOXes using an orderingValue attribute so they can exchange place on the desk.

The problem is with CDs.

I’d like to be able to rearrange the order of the CDs in each one of the BOXes. I can’t use an orderingValue attribute for the CD entity as I do with BOX because if I set it to “5”, that CD will be at the place number 5 in each one of the BOXes and this is not what I want.

I thought using Ordered relationships but I discarded this option ’cause it is not yet compatible with iCloud which I’d like to support.

With a standard database I’d create a third table with BOX.Id, CD.Id and orderingValue and I’ll use it with a JOIN for the sorting.

What is the best option to handle this scenario in CoreData without using ordered relationships?

Thanks

Nicola

Update: I followed codeghost’s advise, it works flawlessly!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:12:57+00:00Added an answer on June 17, 2026 at 7:12 pm

    I followed codeghost’ advise:

    1) I created a third entity which I called “LinkedCD” with only one attribute: orderingValue;

    2) I created a one-to-many relationship from the entity “Box” to “LinkedCD”;

    3) I created a one-to-many relationship from the entity “Cd” to “LinkedCD”.

    I can now sort independently the CDs for each one of the Boxes.

    When I add a CD to one BOX I insert a new LinkedCD entity in CoreData and I compute the starting orderingValue which I update each time the CD is moved inside the BOX UITableView. When the UITableView is loaded I fill it with all the LinkedCD.Cd.name sorted by LinkedCD.orderingValue.

    Everything works flawlessly.

    Nicola

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a core data model that has two entities, Bid and Result. I
I have two Core Data entities ( Client and UserFile ) that I have
Suppose I have core data entities A and B, where B points to A
I have an Core Data Entity with a number of attributes, which include amount(float),
I have an iOS 4 project using Core Data. When I design the Core
It is possible to have one NSManagedObject subclass represent multiple Core Data entities. For
I have Core Data setup in my app and need to fetch a bunch
I have a core data UITableView, the core data managed object has 4 properties
I have a Core Data class Meeting with a property date which I want
I have a core data object and a REST web interface that use different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.