Last active
August 29, 2015 14:10
-
-
Save bobspryn/3af94e7bb7065c47393b to your computer and use it in GitHub Desktop.
Revisions
-
bobspryn revised this gist
Jul 9, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,7 +49,7 @@ -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSI // else if the section is our loading cell MYLoadingCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"MYLoadingCell" forIndexPath:indexPath]; [self.viewModel loadMoreTweets]; return cell; } } @@ -63,7 +63,7 @@ -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSI - (void) awakeFromNib { [super awakeFromNib]; RAC(self.avatarImageView, image) = RACObserve(self, viewModel.tweetAuthorAvatarImage); RAC(self.userNameLabel, text) = RACObserve(self, viewModel.tweetAuthorFullName); RAC(self.tweetTextLabel, text) = RACObserve(self, viewModel.tweetContent); } -
bobspryn revised this gist
Dec 6, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ - (void) viewDidLoad { @weakify(self); [[[RACSignal merge:@[RACObserve(self.viewModel, tweets), RACObserve(self.viewModel, allTweetsLoaded)]] bufferWithTime:0 onScheduler:[RACScheduler mainThreadScheduler]] subscribeNext:^(id value) { @strongify(self); [self.tableView reloadData]; -
bobspryn revised this gist
Dec 6, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,7 +63,7 @@ -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSI - (void) awakeFromNib { [super awakeFromNib]; RAC(self.avatarImageView, image) = RACObserve(self, viewModel.userAvatarImage); RAC(self.userNameLabel, text) = RACObserve(self, viewModel.tweetAuthorFullName); RAC(self.tweetTextLabel, text) = RACObserve(self, viewModel.tweetContent); } -
bobspryn created this gist
Dec 6, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ // // View Controller // - (void) viewDidLoad { [super viewDidLoad]; RAC(self.viewModel, username) = [myTextfield rac_textSignal]; RACSignal *usernameIsValidSignal = RACObserve(self.viewModel, usernameValid); RAC(self.goButton, alpha) = [usernameIsValidSignal map: ^(NSNumber *valid) { return valid.boolValue ? @1 : @0.5; }]; RAC(self.goButton, enabled) = usernameIsValidSignal; RAC(self.avatarImageView, image) = RACObserve(self.viewModel, userAvatarImage); RAC(self.userNameLabel, text) = RACObserve(self.viewModel, userFullName); @weakify(self); [[[RACSignal merge:@[RACObserve(self.viewModel, tweets), RACObserve(self.viewModel, allTweetsLoaded)]] bufferWithTime:0 onScheduler:[RACScheduler mainThreadScheduler]]] subscribeNext:^(id value) { @strongify(self); [self.tableView reloadData]; }]; [[self.goButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext: ^(id value) { @strongify(self); [self.viewModel getTweetsForCurrentUsername]; }]; } -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // if table section is the tweets section if (indexPath.section == 0) { MYTwitterUserCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"MYTwitterUserCell" forIndexPath:indexPath]; // grab the cell view model from the vc view model and assign it cell.viewModel = self.viewModel.tweets[indexPath.row]; return cell; } else { // else if the section is our loading cell MYLoadingCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"MYLoadingCell" forIndexPath:indexPath]; [self.tableView loadMoreTweets]; return cell; } } // // MYTwitterUserCell // // this could also be in cell init - (void) awakeFromNib { [super awakeFromNib]; RAC(self.avatarImageView, image) = RACObserve(self.viewModel, userAvatarImage); RAC(self.userNameLabel, text) = RACObserve(self.viewModel, tweetAuthorFullName); RAC(self.tweetTextLabel, text) = RACObserve(self.viewModel, tweetContent); }