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 7024775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:53:10+00:00 2026-05-27T23:53:10+00:00

I’m sure this must be a common pattern in iOS apps. I have a

  • 0

I’m sure this must be a common pattern in iOS apps. I have a list controller that displays a list of items. I have a segue (using storyboards) to a modal for adding a new item, where I just collect the name. Once dismissed, I will return to the list, update it to include the added item, and do a couple of other small things (lets say log something for simplicity). Crucially, I need to log something that is part of the list controller, not the modal controller.

At some point along the way I also need to insert the new item in to my managed object context.

I have tried two approaches:

1) pass the ManagedObjectContext into the modal’s controller using PrepareForSegue. Insert the new item into the context from the modal’s controller. Works great to this point. But now I want to refresh my view and write my log lines. I can’t put these in viewWillAppear because I don’t want the lines to be logged at first load or any other time, only after returning from the modal.

2) make the list controller a delegate of the modal controller so that I can do all of my work in the list controller itself, and only call the list controller’s code when the save button is used in the modal (averts the issue with running on every load). But since Item is a managed object I can’t create it without reference to the context, which the modal controller knows nothing about, so I can’t insert the item in the modal. I also can’t pass it to the delegate and insert it in the List controller, since there is no way to create a managed object without the context.

What is the established standard for this kind of flow? Maybe I should be using a combination of both – pass along the context to the modal controller so it can handle it’s own insert, and then call the delegate code in the list controller just to handle the logging?

  • 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-27T23:53:11+00:00Added an answer on May 27, 2026 at 11:53 pm

    A combination of 1) and 2) is what I use. Create a new managed object in prepareForSegue and pass this to your modal view controller. Set your list controller as the delegate of the modal view controller, and update your logging in the delegate methods.

    There is no need to have any core data heavy lifting in the modal, it doesn’t need to know those things.

    (In fact, if you’re only setting a name in the modal it doesn’t even need to know about the object, you could just return a string, but if you do pass the object it gives you more flexibility if you decide to make it a bit more functional.)

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have this code to decode numeric html entities to the UTF8 equivalent character.
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.