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

  • Home
  • SEARCH
  • 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 6097433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:02:35+00:00 2026-05-23T13:02:35+00:00

To use CoreData many developers inherit model objects from NSManagedObject . But what if

  • 0

To use CoreData many developers inherit model objects from NSManagedObject.

But what if I wanted to keep my model objects independent from the storage mechanism that is being used (maybe i will reuse them in a project where I dont need persistency at all)?

My solution so far has been to create for each model class a class inheriting from NSManagedObject that has a reference to the model object and loads and stores it.

Whats a better approach?

  • 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-05-23T13:02:36+00:00Added an answer on May 23, 2026 at 1:02 pm

    The best way to work with Core Data is to inherit your model objects from NSManagedObject. You can then control whether to persist or not from the Context, like TechZen pointed.

    If you still insist on not inheriting your model classes from NSManagedObject, it can be of help to combine protocols and categories as described by RyanR. However, you will have in my opinion a big overhead creating protocols, categories and duplicating classes.

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

Sidebar

Related Questions

I have a CoreData model with 2 objects. The first object (Images) contains a
use this website a lot but first time posting. My program creates a number
I am trying to use CoreData to populate a UITableView. I have been using
I've read many of the SO questions on NSManagedObject, the Apple docs, and more,
I have a simple Coredata model with one entity called conversation and the other
I have a strange issue with delete rules in coredata. My data model is
I'm having a problem figuring out how to represent a many-to-many relationship model in
I know that this question had been asked many times, but every answer seems
I created a project for iPad which uses Apple's Use CoreData template. I customized
My iOS application uses CoreData to store many things, and NSUserDefaults to store other

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.