Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MVVM for iOS

laiso
March 12, 2014

MVVM for iOS

iOSアプリケーションの開発にMVVMアーキテクチャの考えを持ち込んで設計を見直そうという話をしました

laiso

March 12, 2014
Tweet

More Decks by laiso

Other Decks in Technology

Transcript

  1. MVVM for iOS MVVM for iOS @laiso @laiso 03/12/2014 03/12/2014

    potatotips#5(at COOKPAD) potatotips#5(at COOKPAD)
  2. σʔλόΠϯσΟϯά σʔλόΠϯσΟϯά = Co‐ = Co‐ coa coaόΠϯσΟϯά όΠϯσΟϯά? ?

    Mac OS X޲͚ͷσʔλόΠϯσΟϯάػߏ iOSʹ͸དྷͯͳ͍ see "Cocoa Bindings Programming Topics" http://news.mynavi.jp/special/2005/cocoamvc/menu.html
  3. ViewModel ViewModelΛ࢓ࠐΉ Λ࢓ࠐΉ StoryboardͷγʔέϯεͰInject // TipsListViewController - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

    { if ([[segue identifier] isEqualToString:@"showDetail"]) { NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; TipsDetailViewController *viewController = segue.destinationViewController; // ભҠઌͷViewModelΛॳظԽͯ͠ฦ͢ viewController.viewModel = [self.viewModel detailViewModelForIndexPath:indexPath]; } }
  4. ViewModel ViewModelͷ୯ମςετ ͷ୯ମςετ it (@"ViewModelͷςετ", ^{ TipsDetailViewModel *viewModel = [[TipsDetailViewModel

    alloc] initWithModel:tips] expect(viewModel.title).to.equal(@"MVVM for iOS"); expect(viewModel.subTitle).to.equal(@""); expect(viewModel.author).to.equal(@"laiso"); });
  5. ࢀߟࢿྉ ࢀߟࢿྉ Code Reuse with MVVM Model-View-ViewModel for iOS |

    Teehan+Lax ReactiveCocoa/Documentation/FrameworkOverview.md at master · ReactiveCocoa/ReactiveCocoa GUI Architectures