Skip to main content

Clean Swift - an alternate to VIPER on iOS

I would like to talk about the alternative to VIPER — Clean Swift. At first glance, Clean Swift is similar to VIPER; however, the differences become visible after looking at the way the modules interact.


The interaction between them happens in cycles. Data transmission is based on protocols (again, similar to VIPER), which allows for replacing one of the components of the system with another one. Generally the interaction process looks like this: the user clicks on a button, the View Controller creates an object with a description and sends it to the Interactor. Interactor, in turn, launches a specific scenario following its business logic, then produces a result object and transfers it to Presenter. Presenter generates an object with the data formatted for presenting it to the user and sends it to the View Controller.

Clean Swift (as opposed to VIPER) has a unidirectional flow of data processing and decision making. There is always only one cycle — View Controller— Interactor — Presenter — View Controller, which simplifies the refactoring, since most of the time you will have to change fewer entities. Because of this, projects with the logic that is often changed (most of the projects that I had to work with) are easier to refactor when using the Clean Swift methodology.

Exyte @ Medium.com

Sounds a lot like MVI to me.
Check also Model-View-Intent Architecture

Comments

Most Favorite Posts

Server-driven UI (SDUI): Meet Zalandos AppCraft and AirBnB Lona

A short WTF: Joe Birch:  SERVER DRIVEN UI, PART 1: THE CONCEPT Zalando seems to follow the SDUI principle as well - defining a common design language and construct the screens on the backend while displaying them natively on the clients. They even go one step further; they implemented a mighty toolset to enable non-technical stakeholders to define their own native app screens Compass: Web tooling to create screens and bind data Beetroot: Backend service that combines the screen layout definition with the data Lapis/Golem: iOS/Android UI render engines Crazy cool! Good job, guys (when you do an open-source release?) To even move faster a Flutter based UI render engine implementation was great! See also AirBnB Lona SDUI approach Building a Visual Language Why Dropbox sunsetted its universal C++ mobile project and AirBnB its React Native implementation

Judo App - Server Driven UI out of the box

Judo App Judo brings server-driven UI to your iOS and Android apps. Build user interfaces visually in a fraction of time and publish them instantly without submitting to the app store. Build Experiences - With No Code The Judo app for macOS, available through the App Store, is built for design professionals with common keyboard shortcuts and familiar concepts like canvas, layers and inspector panel. Workflow is streamlined with the ability to drag and drop media files directly into your experiences and manage your own Judo files in Finder. Manage Creative Execution A Judo experience is interactive and can include text, images, video and buttons. An experience may be part of a screen, a single screen, or more typically multiple linked screens. Judo supports screen transitions, carousels, horizontal scrolling and modals. Clients can add custom fonts and define global colors and these are updates applied universally. Effortlessly Deploy Judo Cloud syncs your experiences with your iOS and ...

Remote Desktop with VNC

Access your Mac from any computer with the use of VNC. This article describes the process of setting up a VNC server on your Mac, and how to access it from afar. Remote Desktop on your Mac for Free VNC Server VNC Client

Native Or Web? Bizness Apps Adds HTML5 Platform To Let SMBs Create Their Own Apps — For Both

Bizness Apps’s value proposition is simple: The startup wants to make mobile apps affordable, customizable, and simple to make for the small business owner. Thus, the startup offers a DIY iPhone, iPad, and Android app platform that enables SMBs to create, edit, and manage mobile apps without any programming experience required. You start with a template, customize them to suit your business, and then Bizness Apps makes them native apps and distributes them on iTunes and the Android Marketplace. TechCrunch

Pieceable Viewer

Show your iOS apps on the web inside an interactive flash movie. Pieceable Viewer works with most iPhone applications. If you have a native binary that runs on the iOS Simulator, it should run in Pieceable Viewer. UIKit based applications work best. OpenGL and MapView based content runs but isn't rendered - these will be better supported in a later version. iPad applications will be supported in a later version. Pieceable

Simple Reachability + Blocks

I like this block-based approach much more as opposed to listening for notifications or having a delegate callback on a central Reachability instance. In most uses-cases I have seen so far you are probably just calling a method on the watching view controller and there it helps that the observer block can capture some state. Because of this we don’t need to use the C-level state passing. At the time of this writing the code for DTReachability is now present on the develop branch of DTFoundation, it will be merged into master for the next release. Since it has a dependency on the SystemConfiguration.framework I put it into its own static lib and Cocoapods sub spec to use individually. I am using this in AutoIngest for Mac now, but it should work without modification on iOS just the same. Your feedback is welcome. Cocoanetics