thoughtbot / ios-on-rails

A guide to building a Rails API and iOS app
Other
76 stars 6 forks source link

Fix chapter "The Confirmation View Controller" #81

Closed sirdharma closed 9 years ago

sirdharma commented 10 years ago

I shall start by mentioning that I am writing the iOS code from the book without looking at your codebase.

In chapter "The Confirmation View Controller", the code in the last paragraph "Linking the Confirm Button to the HUMConfirmationViewController” is not relevant and actually taken from HUMMapViewController.m (it does not belong in HUMAddEventViewController.m).

I think the code that needs to be included should rather be something along those lines:

// HUMAddEventViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 5) {
        [self presentConfirmationViewController];
    }
}

- (void)presentConfirmationViewController
{
    HUMAddEventViewController *confirmationEventViewController = [[HUMConfirmationViewController alloc] init];

    [self.navigationController pushViewController:confirmationEventViewController animated:YES];
}

Also, the implementation for the method - (void)cancelButtonPressed in HUMConfirmationViewController.m is not presented in the "Adding a Cancel Button" paragraph — I think it should be, just like it is in the previous chapter ("The Add an Event View Controller").

dazmuda commented 9 years ago

Thanks for the tipoff! I actually decided to nix the confirmation view controller since it's a bit of sugar that isn't necessary for the general iOS-interacting-with-your-rails-api purpose of the book.

You feedback prompted the question "Do we need this?" so I really appreciate it.