Defining context for Core Data with AppDelegate as a singletonCore Data: Quickest way to delete all instances of an entityPassing Data between View ControllersDoes a Core Data parent ManagedObjectContext need to share a concurrency type with the child context?Core Data context and singleton data controllerMultiple NSManagedObjectContexts issueUsing a dispatch_once singleton model in SwiftCore Data background context best practiceCore Data: error: Exception was caught during Core Data change processingSaving text from a UITextView using core data SwiftGetting an error when attempting to run the app in swift - Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee4ffdee8)
Pressure inside an infinite ocean?
Introducing Gladys, an intrepid globetrotter
What are the differences between credential stuffing and password spraying?
What was Bran's plan to kill the Night King?
I need a disease
ZSPL language, anyone heard of it?
Word for Food that's Gone 'Bad', but is Still Edible?
Should I dumb down my writing in a foreign country?
What to use instead of cling film to wrap pastry
Can my company stop me from working overtime?
What was the first story to feature the plot "the monsters were human all along"?
Wrong answer from DSolve when solving a differential equation
Emotional immaturity of comic-book version of superhero Shazam
Are there any of the Children of the Forest left, or are they extinct?
Upside-Down Pyramid Addition...REVERSED!
In Stroustrup's example, what does this colon mean in `return 1 : 2`? It's not a label or ternary operator
What is the solution to this metapuzzle from a university puzzling column?
Can I use a fetch land to shuffle my deck while the opponent has Ashiok, Dream Render in play?
Can you Ready a Bard spell to release it after using Battle Magic?
Why does this derived table improve performance?
Point of the Dothraki's attack in GoT S8E3?
Why aren't nationalizations in Russia described as socialist?
Is the set of non invertible matrices simply connected? What are their homotopy and homology groups?
Floor of Riemann zeta function
Defining context for Core Data with AppDelegate as a singleton
Core Data: Quickest way to delete all instances of an entityPassing Data between View ControllersDoes a Core Data parent ManagedObjectContext need to share a concurrency type with the child context?Core Data context and singleton data controllerMultiple NSManagedObjectContexts issueUsing a dispatch_once singleton model in SwiftCore Data background context best practiceCore Data: error: Exception was caught during Core Data change processingSaving text from a UITextView using core data SwiftGetting an error when attempting to run the app in swift - Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee4ffdee8)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I’m trying to get my head around NSManagedObjectContext for Core Data. Xcode 10.1 provides a fair amount of boilerplate if the Core Data checkbox is selected when creating a new project. But I find it a bit confusing wrt how the current context is set for each view controller. I think I have a better way and am looking for advice to confirm, or to put me back on the right track.
For example, in the boilerplate AppDelegate code, didFinishLaunchingWithOptions provides the context to the MasterViewController like this:
let masterNavigationController = splitViewController.viewControllers[0] as! UINavigationController
let controller = masterNavigationController.topViewController as! MasterViewController
controller.managedObjectContext = self.persistentContainer.viewContex
In the MasterViewContoller, the first use of context picks it up from the fetchedResultsController AND there is code to save the context provided, even though the AppDelegate already has a saveContext() function available to do the same thing:
@objc
func insertNewObject(_ sender: Any)
let context = self.fetchedResultsController.managedObjectContext
let newEvent = Event(context: context)
// If appropriate, configure the new managed object.
newEvent.timestamp = Date()
// Save the context.
do
try context.save()
catch
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error (nserror), (nserror.userInfo)")
In my app with multiple view controllers I have made mistakes trying to re-declare or hand off the context in each one where it’s needed, so had to contend with errors that were caused by inadvertently having more than one context flying around.
So my question is this: Am I making a mistake, or is there some downside to the following approach:
1) Make the AppDelegate a singleton:
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
static let shared = AppDelegate()
…
2) In each class where it’s needed, always define the context (I’m assuming I only need one) like this:
let context = AppDelegate.shared.persistentContainer.viewContext
3) Whenever the context needs to be saved, do it like this:
AppDelegate.shared.saveContext()
That seems much simpler, clearer and less prone to errors, and seems to work in my implementation. Are there problems with this that I'm not seeing?
ios swift core-data nsmanagedobjectcontext
add a comment |
I’m trying to get my head around NSManagedObjectContext for Core Data. Xcode 10.1 provides a fair amount of boilerplate if the Core Data checkbox is selected when creating a new project. But I find it a bit confusing wrt how the current context is set for each view controller. I think I have a better way and am looking for advice to confirm, or to put me back on the right track.
For example, in the boilerplate AppDelegate code, didFinishLaunchingWithOptions provides the context to the MasterViewController like this:
let masterNavigationController = splitViewController.viewControllers[0] as! UINavigationController
let controller = masterNavigationController.topViewController as! MasterViewController
controller.managedObjectContext = self.persistentContainer.viewContex
In the MasterViewContoller, the first use of context picks it up from the fetchedResultsController AND there is code to save the context provided, even though the AppDelegate already has a saveContext() function available to do the same thing:
@objc
func insertNewObject(_ sender: Any)
let context = self.fetchedResultsController.managedObjectContext
let newEvent = Event(context: context)
// If appropriate, configure the new managed object.
newEvent.timestamp = Date()
// Save the context.
do
try context.save()
catch
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error (nserror), (nserror.userInfo)")
In my app with multiple view controllers I have made mistakes trying to re-declare or hand off the context in each one where it’s needed, so had to contend with errors that were caused by inadvertently having more than one context flying around.
So my question is this: Am I making a mistake, or is there some downside to the following approach:
1) Make the AppDelegate a singleton:
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
static let shared = AppDelegate()
…
2) In each class where it’s needed, always define the context (I’m assuming I only need one) like this:
let context = AppDelegate.shared.persistentContainer.viewContext
3) Whenever the context needs to be saved, do it like this:
AppDelegate.shared.saveContext()
That seems much simpler, clearer and less prone to errors, and seems to work in my implementation. Are there problems with this that I'm not seeing?
ios swift core-data nsmanagedobjectcontext
2) option makes sense, it’s super easy and work well.
– Mannopson
Mar 23 at 1:41
add a comment |
I’m trying to get my head around NSManagedObjectContext for Core Data. Xcode 10.1 provides a fair amount of boilerplate if the Core Data checkbox is selected when creating a new project. But I find it a bit confusing wrt how the current context is set for each view controller. I think I have a better way and am looking for advice to confirm, or to put me back on the right track.
For example, in the boilerplate AppDelegate code, didFinishLaunchingWithOptions provides the context to the MasterViewController like this:
let masterNavigationController = splitViewController.viewControllers[0] as! UINavigationController
let controller = masterNavigationController.topViewController as! MasterViewController
controller.managedObjectContext = self.persistentContainer.viewContex
In the MasterViewContoller, the first use of context picks it up from the fetchedResultsController AND there is code to save the context provided, even though the AppDelegate already has a saveContext() function available to do the same thing:
@objc
func insertNewObject(_ sender: Any)
let context = self.fetchedResultsController.managedObjectContext
let newEvent = Event(context: context)
// If appropriate, configure the new managed object.
newEvent.timestamp = Date()
// Save the context.
do
try context.save()
catch
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error (nserror), (nserror.userInfo)")
In my app with multiple view controllers I have made mistakes trying to re-declare or hand off the context in each one where it’s needed, so had to contend with errors that were caused by inadvertently having more than one context flying around.
So my question is this: Am I making a mistake, or is there some downside to the following approach:
1) Make the AppDelegate a singleton:
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
static let shared = AppDelegate()
…
2) In each class where it’s needed, always define the context (I’m assuming I only need one) like this:
let context = AppDelegate.shared.persistentContainer.viewContext
3) Whenever the context needs to be saved, do it like this:
AppDelegate.shared.saveContext()
That seems much simpler, clearer and less prone to errors, and seems to work in my implementation. Are there problems with this that I'm not seeing?
ios swift core-data nsmanagedobjectcontext
I’m trying to get my head around NSManagedObjectContext for Core Data. Xcode 10.1 provides a fair amount of boilerplate if the Core Data checkbox is selected when creating a new project. But I find it a bit confusing wrt how the current context is set for each view controller. I think I have a better way and am looking for advice to confirm, or to put me back on the right track.
For example, in the boilerplate AppDelegate code, didFinishLaunchingWithOptions provides the context to the MasterViewController like this:
let masterNavigationController = splitViewController.viewControllers[0] as! UINavigationController
let controller = masterNavigationController.topViewController as! MasterViewController
controller.managedObjectContext = self.persistentContainer.viewContex
In the MasterViewContoller, the first use of context picks it up from the fetchedResultsController AND there is code to save the context provided, even though the AppDelegate already has a saveContext() function available to do the same thing:
@objc
func insertNewObject(_ sender: Any)
let context = self.fetchedResultsController.managedObjectContext
let newEvent = Event(context: context)
// If appropriate, configure the new managed object.
newEvent.timestamp = Date()
// Save the context.
do
try context.save()
catch
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error (nserror), (nserror.userInfo)")
In my app with multiple view controllers I have made mistakes trying to re-declare or hand off the context in each one where it’s needed, so had to contend with errors that were caused by inadvertently having more than one context flying around.
So my question is this: Am I making a mistake, or is there some downside to the following approach:
1) Make the AppDelegate a singleton:
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
static let shared = AppDelegate()
…
2) In each class where it’s needed, always define the context (I’m assuming I only need one) like this:
let context = AppDelegate.shared.persistentContainer.viewContext
3) Whenever the context needs to be saved, do it like this:
AppDelegate.shared.saveContext()
That seems much simpler, clearer and less prone to errors, and seems to work in my implementation. Are there problems with this that I'm not seeing?
ios swift core-data nsmanagedobjectcontext
ios swift core-data nsmanagedobjectcontext
asked Mar 22 at 23:07
tkhelmtkhelm
64
64
2) option makes sense, it’s super easy and work well.
– Mannopson
Mar 23 at 1:41
add a comment |
2) option makes sense, it’s super easy and work well.
– Mannopson
Mar 23 at 1:41
2) option makes sense, it’s super easy and work well.
– Mannopson
Mar 23 at 1:41
2) option makes sense, it’s super easy and work well.
– Mannopson
Mar 23 at 1:41
add a comment |
1 Answer
1
active
oldest
votes
To be honest Apple examples / templates always was bad example for beginners, because they show only one thing and "hack" on rest (force unwrapping everything for example). And beginners tend to just copy this approach.
Disclaimer: I talking about middle-big size applications. You always can broke this rules and recommendations in small apps, cause not using them can be easier and lead to simpler application.
Make the AppDelegate a singleton:
In 99% you should not instantiate AppDelegate
by self. It handled for you by UIApplication
/ @UIApplicationMain
annotation.
AppDelegate
already singleton, since each application has exactly one delegate for whole lifetime. You can access it by UIApplication.shared.delegate as? AppDelegate
.
But you shouldn't. AppDelegate
play specific role in each app by providing entry point for communication between system and your code and you shouldn't add additional roles to it (as handle database). Accessing it somewhere in codebase in most case signs of code smell and bad architecture.
Separating CoreData stack
DataBase access is one of few examples of good use of Singleton pattern. But instead of using AppDelegate
you should make separate service that will be responsible only for handling communication with coredata (such as creating and handling stack, sending queries and etc).
So CoreDataService
is way to go.
Accessing core data
Using singletons doesn't mean you can just access it anywhere by typing Singleton.shared
. This will highly decrease testability of your components and make them highly coupled to singletons.
Instead you should read about Dependency injection principle and inject your singletons. E.g:
class MyViewController: UIViewController
let dataBaseManager: CoreDataService
init(with dataBaseManager: CoreDataService)
self.dataBaseManager = dataBaseManager
super.init(nibName: nil, bundle: nil)
Ideally you should go even further to SOLID and provide to controller only what it really needs:
protocol EventsProvider
func getEvents(with callback: [Event] -> Void)
extension CoreDataService: EventsProvider
func getEvents(with callback: [Event] -> Void)
// your core data query here
class MyViewController: UIViewController
let eventsProvider: EventsProvider
init(with eventsProvider: EventsProvider)
self.eventsProvider = eventsProvider
super.init(nibName: nil, bundle: nil)
let vc = MyViewController(with: CoreDataService.shared)
Multiple contexts
Having multiple NSManagedObjectContext
can be handy and improve performance, but only when you know how to work with them.
It's more advance topic, so you can ignore it for now.
You can read about it in Core Data Programming Guide
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308886%2fdefining-context-for-core-data-with-appdelegate-as-a-singleton%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
To be honest Apple examples / templates always was bad example for beginners, because they show only one thing and "hack" on rest (force unwrapping everything for example). And beginners tend to just copy this approach.
Disclaimer: I talking about middle-big size applications. You always can broke this rules and recommendations in small apps, cause not using them can be easier and lead to simpler application.
Make the AppDelegate a singleton:
In 99% you should not instantiate AppDelegate
by self. It handled for you by UIApplication
/ @UIApplicationMain
annotation.
AppDelegate
already singleton, since each application has exactly one delegate for whole lifetime. You can access it by UIApplication.shared.delegate as? AppDelegate
.
But you shouldn't. AppDelegate
play specific role in each app by providing entry point for communication between system and your code and you shouldn't add additional roles to it (as handle database). Accessing it somewhere in codebase in most case signs of code smell and bad architecture.
Separating CoreData stack
DataBase access is one of few examples of good use of Singleton pattern. But instead of using AppDelegate
you should make separate service that will be responsible only for handling communication with coredata (such as creating and handling stack, sending queries and etc).
So CoreDataService
is way to go.
Accessing core data
Using singletons doesn't mean you can just access it anywhere by typing Singleton.shared
. This will highly decrease testability of your components and make them highly coupled to singletons.
Instead you should read about Dependency injection principle and inject your singletons. E.g:
class MyViewController: UIViewController
let dataBaseManager: CoreDataService
init(with dataBaseManager: CoreDataService)
self.dataBaseManager = dataBaseManager
super.init(nibName: nil, bundle: nil)
Ideally you should go even further to SOLID and provide to controller only what it really needs:
protocol EventsProvider
func getEvents(with callback: [Event] -> Void)
extension CoreDataService: EventsProvider
func getEvents(with callback: [Event] -> Void)
// your core data query here
class MyViewController: UIViewController
let eventsProvider: EventsProvider
init(with eventsProvider: EventsProvider)
self.eventsProvider = eventsProvider
super.init(nibName: nil, bundle: nil)
let vc = MyViewController(with: CoreDataService.shared)
Multiple contexts
Having multiple NSManagedObjectContext
can be handy and improve performance, but only when you know how to work with them.
It's more advance topic, so you can ignore it for now.
You can read about it in Core Data Programming Guide
add a comment |
To be honest Apple examples / templates always was bad example for beginners, because they show only one thing and "hack" on rest (force unwrapping everything for example). And beginners tend to just copy this approach.
Disclaimer: I talking about middle-big size applications. You always can broke this rules and recommendations in small apps, cause not using them can be easier and lead to simpler application.
Make the AppDelegate a singleton:
In 99% you should not instantiate AppDelegate
by self. It handled for you by UIApplication
/ @UIApplicationMain
annotation.
AppDelegate
already singleton, since each application has exactly one delegate for whole lifetime. You can access it by UIApplication.shared.delegate as? AppDelegate
.
But you shouldn't. AppDelegate
play specific role in each app by providing entry point for communication between system and your code and you shouldn't add additional roles to it (as handle database). Accessing it somewhere in codebase in most case signs of code smell and bad architecture.
Separating CoreData stack
DataBase access is one of few examples of good use of Singleton pattern. But instead of using AppDelegate
you should make separate service that will be responsible only for handling communication with coredata (such as creating and handling stack, sending queries and etc).
So CoreDataService
is way to go.
Accessing core data
Using singletons doesn't mean you can just access it anywhere by typing Singleton.shared
. This will highly decrease testability of your components and make them highly coupled to singletons.
Instead you should read about Dependency injection principle and inject your singletons. E.g:
class MyViewController: UIViewController
let dataBaseManager: CoreDataService
init(with dataBaseManager: CoreDataService)
self.dataBaseManager = dataBaseManager
super.init(nibName: nil, bundle: nil)
Ideally you should go even further to SOLID and provide to controller only what it really needs:
protocol EventsProvider
func getEvents(with callback: [Event] -> Void)
extension CoreDataService: EventsProvider
func getEvents(with callback: [Event] -> Void)
// your core data query here
class MyViewController: UIViewController
let eventsProvider: EventsProvider
init(with eventsProvider: EventsProvider)
self.eventsProvider = eventsProvider
super.init(nibName: nil, bundle: nil)
let vc = MyViewController(with: CoreDataService.shared)
Multiple contexts
Having multiple NSManagedObjectContext
can be handy and improve performance, but only when you know how to work with them.
It's more advance topic, so you can ignore it for now.
You can read about it in Core Data Programming Guide
add a comment |
To be honest Apple examples / templates always was bad example for beginners, because they show only one thing and "hack" on rest (force unwrapping everything for example). And beginners tend to just copy this approach.
Disclaimer: I talking about middle-big size applications. You always can broke this rules and recommendations in small apps, cause not using them can be easier and lead to simpler application.
Make the AppDelegate a singleton:
In 99% you should not instantiate AppDelegate
by self. It handled for you by UIApplication
/ @UIApplicationMain
annotation.
AppDelegate
already singleton, since each application has exactly one delegate for whole lifetime. You can access it by UIApplication.shared.delegate as? AppDelegate
.
But you shouldn't. AppDelegate
play specific role in each app by providing entry point for communication between system and your code and you shouldn't add additional roles to it (as handle database). Accessing it somewhere in codebase in most case signs of code smell and bad architecture.
Separating CoreData stack
DataBase access is one of few examples of good use of Singleton pattern. But instead of using AppDelegate
you should make separate service that will be responsible only for handling communication with coredata (such as creating and handling stack, sending queries and etc).
So CoreDataService
is way to go.
Accessing core data
Using singletons doesn't mean you can just access it anywhere by typing Singleton.shared
. This will highly decrease testability of your components and make them highly coupled to singletons.
Instead you should read about Dependency injection principle and inject your singletons. E.g:
class MyViewController: UIViewController
let dataBaseManager: CoreDataService
init(with dataBaseManager: CoreDataService)
self.dataBaseManager = dataBaseManager
super.init(nibName: nil, bundle: nil)
Ideally you should go even further to SOLID and provide to controller only what it really needs:
protocol EventsProvider
func getEvents(with callback: [Event] -> Void)
extension CoreDataService: EventsProvider
func getEvents(with callback: [Event] -> Void)
// your core data query here
class MyViewController: UIViewController
let eventsProvider: EventsProvider
init(with eventsProvider: EventsProvider)
self.eventsProvider = eventsProvider
super.init(nibName: nil, bundle: nil)
let vc = MyViewController(with: CoreDataService.shared)
Multiple contexts
Having multiple NSManagedObjectContext
can be handy and improve performance, but only when you know how to work with them.
It's more advance topic, so you can ignore it for now.
You can read about it in Core Data Programming Guide
To be honest Apple examples / templates always was bad example for beginners, because they show only one thing and "hack" on rest (force unwrapping everything for example). And beginners tend to just copy this approach.
Disclaimer: I talking about middle-big size applications. You always can broke this rules and recommendations in small apps, cause not using them can be easier and lead to simpler application.
Make the AppDelegate a singleton:
In 99% you should not instantiate AppDelegate
by self. It handled for you by UIApplication
/ @UIApplicationMain
annotation.
AppDelegate
already singleton, since each application has exactly one delegate for whole lifetime. You can access it by UIApplication.shared.delegate as? AppDelegate
.
But you shouldn't. AppDelegate
play specific role in each app by providing entry point for communication between system and your code and you shouldn't add additional roles to it (as handle database). Accessing it somewhere in codebase in most case signs of code smell and bad architecture.
Separating CoreData stack
DataBase access is one of few examples of good use of Singleton pattern. But instead of using AppDelegate
you should make separate service that will be responsible only for handling communication with coredata (such as creating and handling stack, sending queries and etc).
So CoreDataService
is way to go.
Accessing core data
Using singletons doesn't mean you can just access it anywhere by typing Singleton.shared
. This will highly decrease testability of your components and make them highly coupled to singletons.
Instead you should read about Dependency injection principle and inject your singletons. E.g:
class MyViewController: UIViewController
let dataBaseManager: CoreDataService
init(with dataBaseManager: CoreDataService)
self.dataBaseManager = dataBaseManager
super.init(nibName: nil, bundle: nil)
Ideally you should go even further to SOLID and provide to controller only what it really needs:
protocol EventsProvider
func getEvents(with callback: [Event] -> Void)
extension CoreDataService: EventsProvider
func getEvents(with callback: [Event] -> Void)
// your core data query here
class MyViewController: UIViewController
let eventsProvider: EventsProvider
init(with eventsProvider: EventsProvider)
self.eventsProvider = eventsProvider
super.init(nibName: nil, bundle: nil)
let vc = MyViewController(with: CoreDataService.shared)
Multiple contexts
Having multiple NSManagedObjectContext
can be handy and improve performance, but only when you know how to work with them.
It's more advance topic, so you can ignore it for now.
You can read about it in Core Data Programming Guide
answered Mar 23 at 1:36
ManWithBearManWithBear
1,809720
1,809720
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308886%2fdefining-context-for-core-data-with-appdelegate-as-a-singleton%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2) option makes sense, it’s super easy and work well.
– Mannopson
Mar 23 at 1:41