sosaagbontaen / Flixter

0 stars 0 forks source link

Feedback #2

Open naveenfive opened 2 years ago

naveenfive commented 2 years ago

Style

This is a good reference for coding style: https://github.com/NYTimes/objective-c-style-guide

Class name and File names should start with Capital Letters. ✅

Properties and local variables MUST be camel-case with the leading word being lowercase. ✅

Properties should be accessed using self.propertyName instead of _propertyName. ✅

My personal opinion for your naming: I like the way you name things! Awesome job!

Reusing your details view controller

Think about how you can reuse the same detail view controller when you tap on a cell in your collection view.

Commit Messages

Commit messages should follow these guidelines: https://cbea.ms/git-commit/

Awesome job with your commits!

Since this is the first project, I do not expect you to have commits, but in the future, please add a commit for every feature.

Logging

You should be logging every function in your application. This will help you understand your function call order. In production app, you'll likely be logging errors and crashes. You will also be tracking every user action.

NSLog(@"%@", NSStringFromSelector(_cmd));

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@", NSStringFromSelector(_cmd));
}

I personally add my initials to my log messages on my personal projects because it makes it easy for me to filter because you will receive log messages from various places.

My log messages look like this: NSLog(@":NC: %@", NSStringFromSelector(_cmd));

UITableViewDelegate

You could also use UITableViewDelegate to navigate to details screen instead of segues.

Step 1

Conform to the UITableViewDelegate

@interface MovieViewController () <UITableViewDataSource, UITableViewDelegate>

You'll also need to specify to the table view who the delegate is which is similar to how you specified to the table view who the data source was.

    self.tableView.dataSource = self;
    self.tableView.delegate = self;

Step 2

Implement didSelectRowAtIndexPath method of UITableViewDelegate interface.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

}

Step 3

Add a storyboard id for your details view controller

Screen Shot 2022-06-19 at 12 31 03 PM

Step 4

You will instantiate your view controller from storyboard and push it with your navigation controller. Navigation Controller will be nil if you did not embed your view controller in a navigation controller in storyboard.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UINavigationController *navigationController = self.navigationController;
    MovieDetailsViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MovieDetailsViewController"];
    viewController.movie = self.movies[indexPath.row];
    [navigationController pushViewController: viewController animated:YES];
}