Skip to content

tomaszwojcik/bidirectional-mvvm-swift-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Bidirectional MVVM (for iOS, Swift 4)

Why?

Because I wanted to see how I can do "real" MVVM, that dynamically exchanges data between view and model (not, as in most examples, only sends data to view).

In addition it's a real-world example of Swift 4 key path usage.

Structure of project

Project is divived in 4 groups, to keeps things simple:

  • Binding - KeyPathBinding, for simplicity it handles only String data types
  • Model - Credentials model (with 2 string fields)
  • ViewModel - you should do all model and view operation via LoginViewModel class
  • Controller - in which you bind UITextFields to our view model

Important note about structs

This example works for structs, however each binding creates it's own struct copy.

About

Example of bidirectional MVVM, written for iOS, in Swift 4.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages