Skip to main content

iOS Architecture Patterns - Demystifying MVC, MVP, MVVM and VIPER

Feeling weird while doing MVC in iOS? Have doubts about switching to MVVM? Heard about VIPER, but not sure if it worth it?

You are about to structure your knowledge about architectural patterns in iOS environment. We’ll briefly review some popular ones and compare them in theory and practice going over a few tiny examples. Follow links if you need more details about any particular one.
Mastering design patterns might be addictive, so beware: you might end up asking yourself more questions now than before reading this article, like these:

  • Who supposed to own networking request: a Model or a Controller?
  • How do I pass a Model into a View Model of a new View?
  • Who creates a new VIPER module: Router or Presenter?
Bohdan Orlov medium.com

Comments

Most Favorite Posts

Using Speech with iOS and Android: SiriKit, Voice Capabilities, Google Assistant

SiriKit SiriKit enables your iOS apps and watchOS apps to work with Siri, so users can get things done using just their voice. Your content and services can be used in new scenarios including access from the lock screen and hands-free use. Apps adopt SiriKit by building an extension that communicates with Siri, even when your app isn’t running. The extension registers with specific domains and intents that it can handle. For example, a messaging app would likely register to support the Messages domain, and the intent to send a message. Siri handles all of the user interaction, including the voice and natural language recognition, and works with your extension to get information and handle user requests. Apple Developer Adding Voice Capabilites Voice actions are an important part of the wearable experience. They let users carry out actions hands-free and quickly. Wear provides two types of voice actions: System-provided These voice actions are task-based and are built into ...

Titanium: Releasing Memory

- It’s true that you can’t manually manage your application objects’ reference count in iOS applications. There are, however, things you can do to free up memory – the big ones in the 1.x product are closing windows (which releases all UI resources associated with the window) and setting references to a proxy object (like one returned by Ti.UI.createXXX) to null, which will release the resources associated with that object. Why you should stay away from Titanium

CFPropertyList

The PHP implementation of Apple's PropertyList plist can handle XML PropertyLists as well as binary PropertyLists. It offers functionality to easily convert data between worlds, e.g. recalculating timestamps from unix epoch to apple epoch and vice versa. A feature to automagically create (guess) the plist structure from a normal PHP data structure will help you dump your data to plist in no time. github

Leveraging your iPhone development expertise to build Windows Phone 7 applications

Assuming you are a happy coder, the joy of developing software all comes down to a few things: Building something cool that users will enjoy Getting rewards from users and recognition from peers Learning how to solve new challenges and build novel features. Even if you have a solid expertise on a particular platform/language, I think it is essential to be a “polyglot” developer. In other words, you might have a native or preferred language, but opening your mind to others can be very stimulating and will bring considerable value to your abilities and your resume. Jumping from one platform or language to another can introduce breaking changes in your habits, but ultimately change is very stimulating and will expand your opportunities. If you are a .NET developer, learning Windows Phone development is not really “change.” Instead, it is more of a continuum, where you just add new features to what you already know. If you are an iPhone developer, new to Windows Phone (and .NET), ...

Speed up your unit tests! Swap out your App Delegate for testing.

Faster, please One thing that can slow our tests down is if our App performs expensive tasks on startup and it is not unusual to place code that synchronizes with a server in our implementation of UIAppDelegate. Luckily for us there is a way to change the production App Delegate with a fake that does nothing. Objective-C class FakeAppDelegate: UIResponder, UIApplicationDelegate {   var window: UIWindow?   func application(application: UIApplication,     didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {     self.window?.rootViewController = UIViewController()     return true   } } let isRunningTests = NSClassFromString("XCTestCase") != nil if isRunningTests {   UIApplicationMain(Process.argc, Process.unsafeArgv, nil,     NSStringFromClass(FakeAppDelegate)) } else {   UIApplicationMain(Process.argc, Process.unsafeArgv, nil,     NSStringFromClass(AppDelegate)) ...

CouchDB for iOS

A build of Apache CouchDB optimized for iPad, iPhone, and iPod Touch iOS-Couchbase CouchDB - Key Features Documents Views Schema-Free Distributed CouchDB is a peer based distributed database system. Any number of CouchDB hosts (servers and offline-clients) can have independent “replica copies” of the same database, where applications have full database interactivity (query, add, edit, delete). When back online or on a schedule, database changes are replicated bi-directionally. CouchDB has built-in conflict detection and management and the replication process is incremental and fast, copying only documents and individual fields changed since the previous replication. Most applications require no special planning to take advantage of distributed updates and replication. CouchDB