Srdan Rasic A software engineer

A Different Take on MVVM with Swift

Model-View-ViewModel or MVVM is everywhere these days. There isn’t a day I don’t see a blog post or a tweet about it. It’s being praised into havens. But what exactly is MVVM? What is a ViewModel? What are its concerns? Many seem to have different opinions.

Implementing Reactive Delegates in Swift Powered by Objective-C

I love statically typed languages. I was always more C++ than Objective-C guy. Knowing that I have compiler watching my back all the time makes me feel better about the code I write. The joy I felt back in 2014 watching Swift introductory streams at WWDC will probably stay with me for a long time.

Solving the iOS Binding Problem with Swift

This text was originally published at Check out the original for some nice illustrations! 

Bindings, Generics, Swift and MVVM

In previous post I’ve introduced MVVM design pattern as an improvement to MVC, but I’ve ended with the solution that covers only certain scenarios - immutable models and view models. To cover rest of them we need mutable view models that can propagate changes to views or view controllers they populate.

From MVC to MVVM in Swift

For the past year and a half I’ve been working on a project that’s grown from a simple news reading phone app to a full-blown virtual newspaper for both phones and tablets. Following Apple’s advice and sticking with Model-View-Controller (MVC) design pattern seemed like a good idea at first, but as the app continued to grow, logic that drove some parts of it started to became complex to the point where making changes was accompanied with the feeling of unease and fixing issues in one part of the code with the fear of causing new bugs in some other parts. It would not be fair to blame only MVC for that - of course that some problems are caused by bad programming, lack of experience and the pressure of hard deadlines - but MVC is not well-wisher either. Thinking only in the terms of model, view and controller, one can miss some useful possibilities of how responsibilities can be further separated and dependency graph simplified. In following paragraphs I’ll present a situation where MVC can be improved by expanding it to MVVM (I’ll explain what that is later).