Post

Replies

Boosts

Views

Activity

Reply to How to pass reference to NSPersistentContainer to storyboard-created table view controller in objective c
@eskimo thanks. when trying to use the creator method, it looks like I'm only allowed to pass an NSCoder in the block. Can you provide an example of how I might fix this to include persistentContainer assignment? ToDoListTableViewController *todoListVC = [mainSB instantiateViewControllerWithIdentifier:@"ToDoListTableViewController" creator:^UIViewController * _Nullable(NSCoder * _Nonnull coder) { return [[ToDoListTableViewController alloc] initWithCoder:coder]; }]; todoListVC.persistentContainer = self.persistentContainer;
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’23
Reply to How to pass reference to NSPersistentContainer to storyboard-created table view controller in objective c
after having added breakpoints, I'm seeing that the initWithCoder that I overrode is being called twice by two different instances of the TodoListTableViewController, which makes me think only one of these is a reference to the one I added using storyboard. I'm not sure if this helps with identifying the issue. Thanks
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Apr ’23
Reply to How to pass reference to NSPersistentContainer to storyboard-created table view controller in objective c
@eskimo thanks. when trying to use the creator method, it looks like I'm only allowed to pass an NSCoder in the block. Can you provide an example of how I might fix this to include persistentContainer assignment? ToDoListTableViewController *todoListVC = [mainSB instantiateViewControllerWithIdentifier:@"ToDoListTableViewController" creator:^UIViewController * _Nullable(NSCoder * _Nonnull coder) { return [[ToDoListTableViewController alloc] initWithCoder:coder]; }]; todoListVC.persistentContainer = self.persistentContainer;
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Apr ’23