Example code accompanying the presentation at DWX 2016, Nuremberg, Germany
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


MVVM and FRP: Perfect architectures for mobile development?

Swift 3.1.x platforms GitHub license Travis build

What every developer should know about MVVM and FRP.

This set of files accompanies a presentation at the Developer Week 2016 conference, Nuremberg, Germany. See http://dwx2016.nua-schroers.de for further information (in German). It has been updated for compatibility with Swift 3.

The match game

Concepts of the presentation are the MVVM (model-view-view model) architecture and FRP (functional reactive programming). A sample app illustrates the concepts by giving different ways to implement a simple game using different architectures and paradigms.

All sample codes are written in the Swift programming language version 3 and require Xcode 8 or higher. They have been tested on MacOS X (version 10.11.6) and iOS (version 10.2).


The following directories are used:

  • 01_Common : Contains files used by several projects, like graphics resources, the data model and the custom view.
  • 10_Commandline-App : A command line version of the match game to demonstrate the data model.
  • 20_Basic-App : An iPhone app version of the match game implemented using a classic MVC architecture.
  • 30_MVVM-App : The iPhone app using the MVVM architecture, but no further external dependencies.
  • 40_MVVM_FRP-App/Matchgame : The iPhone app using the MVVM architecture and FRP with ReactiveCocoa.
  • 41_MVVM_FRP-App_ExplicitSignals : Variant of the MVVM/FRP app which illustrates how to use, map and combine signals to enable/disable the "Take 2" button.
  • 42_MVVM_FRP-App_WarningDialog : Variant of the MVVM/FRP app which introduces a behavior/workflow change and displays a dialog in certain situations when leaving the settings screen.

NOTE: Currently, the MVVM-FRP app uses a pre-release version of the ReactiveCocoa library. This code may change since the library is not yet API stable. This is necessary, because Swift 3 is not (yet) supported in a stable release.

Installation and use

For the command line version, the MVC and the MVVM apps, simply open the project file Matchgame.xcodeproj in the corresponding Matchgame subfolder.

For the MVVM-FRP app in addition carthage is required. Prior to opening the project file, please run

cd 40_MVVM_FRP-App/Matchgame/ ; carthage update --platform iOS

to install the necessary dependencies.

License and attribution

Documentation and associated written materials are subject to the CC BY-NC-SA 4.0 license.

The accompanying software is copyright (c) 2012-2017 Dr. Wolfram Schroers, Numerik & Analyse Schroers and subject to the conditions in the file LICENSE.

The launch image and the icons are modified copies of a photo by Derek Gavey which has been licensed under the CC-BY 2.0 license. The photo is available on Flikr.