I have two view's in my app. In the first view I have a table view which displays data downloaded from the Internet. The FirstViewController
has a method to get the data and update the view:
- (void)viewDidLoad
{
// Create PlanGenerator
_planGenerator = [[PlanGenerator alloc] init]
[self loadPlan];
- (void)loadPlan
{
_plan = [_planGenerator getData]
// Updating the view
// Updating the table view
[self.tableView reloadData]
}
To download the data from the internet I have a class called PlanGenerator
. This class has an instance method called getData
, it returns an NSArray. The table view uses the instance variable _plan
(array) to display data in the table view.
In the second view (controlled by the SecondViewController
) you can make some adjustments on what to download. To tell these change the PlanGenerator
I used the concept of class properties. Now when I changed something in the second view (actually it's just one parameter) I want to call the method loadPlan
from the FirstViewController
.
My first thought was to create a class method, but then I would have to creat "class properties" for every variable the method uses.
Is there an easier way to do this?