Software Dev

The what, why, and how of the RIBs mobile architecture

Continuing my mobile architecture kick, let’s look next at RIBs. In this case, RIBs is not a delicious, slow-cooked entrée but rather a software architecture that Uber developed a few years ago. It lets their 200+ mobile developers knock out features quickly without stomping all over each other.

Why RIBs?

The original design worked well for the first three developers. (via Uber)

Back in 2016, the Uber team had quickly expanded from three mobile developers to 15 to several hundred. But the app’s design did not scale well. It became difficult to add features, from both a UI design and a technical perspective. Citing “quite a few examples of, you know, pretty bad UI”, the design team bravely demanded a rewrite.

The design team came in and said, you know, ‘We probity have to redesign the whole application.’… Everybody was super concerned.

Classic engineering understatement

The Uber engineering team resisted the rewrite (which can be nightmare on a large app) for a year, but eventually came around to its necessity. So they defined a few goals for the new design (99.99% reliability, scaling to ~1000 developers, …) and experimented with that they knew – MVC, MVVM, MVP, and VIPER.

Nothing worked. 🤦🏻‍♂️

The problem is that all these architectures are based around the view, and if you base everything around the view, everybody has to integrate at one point, and that becomes a mess at the scale that we have.

The state tree solution

So they came up with a fresh idea, which was to model the whole app as a state tree. Much to their surprise, it worked really well. 🤷🏻‍♂️

We haven’t found an application that you couldn’t model with this very nicely.

The crack architecture team spent six months reworking some “super ugly looking” core app flows, and then turned the rest of the team loose on the new architecture.

And now we have RIBs and the modern Uber app.

Whoa! That looks too easy! (via Uber)

But how does it work?

A RIB is a combination of Router/Interactor/Builder (plus Presenter/View, but I guess “RIBPV” doesn’t sound very good). Each RIB represents a state of the app, which can have sub-states as children.

For example, the root of the tree has two children: logged-out and logged-in. Every RIB under logged-in can safely assume that the user is logged in — and it has an authenticated user token to prove it. 🔑

RIBs present themselves hierarchically on top of each other on the screen. Or some RIBs just do background support don’t show themselves at all.

No auth token for you, left side. (via Uber)

For more…

Pretty cool, eh?

Okay, I’ll stop here since this is a conceptual overview (aka a teaser) and not a tutorial. ✋ For more details, see the original Uber presentation below or try it yourself at the RIBs GitHub repo.

Up next in the architectural series, we’ll attack The Composable Architecture, which is responsible for at least one cool game and, like RIBS, has a concrete implementation rather than just a bunch of vague ideas. 🙏

Software Dev

Scaling up: how AirBnB ships a quality, gigantic app

AirBnB’s iPhone app has a gigantic code base (1.5 million lines of first-party code), a giant mobile team (75 iOS engineers), and a long history (first commit: 2010).

Over time, their app got so big and complex that the project began to take minutes to open (not build) in Xcode. Developers had to use the USB port on the right side of their MacBooks to avoid thermal throttling. 🤦🏻‍♂️

Given all this sheer complexity, the team there made some clever adjustments to develop, test, and ship their app pretty efficiently. Check it out.

👉 Designing for Productivity in a Large-Scale iOS Application

Among the highlights are independent modules called Dev Apps.

A Dev App allows a product developer to iterate on their feature’s UI and much of its business logic while building a fraction of the overall Airbnb application.

Dev App for an existing Airbnb module

For dependencies across modules, module types allow for “visibility rules” to minimize and document dependencies.

Also, AirBnB uses the Buck build system to keep Xcode projects out of source control (bye bye, Xcode project merge conflicts).

via iOS Dev Weekly.

Software Dev

Pulse: Network Inspector

If you want to debug your network traffic on iOS, Pulse looks like a great alternative to WiresharkProxyman, and Charles Proxy.

Pulse takes a different approach, embedding into your app rather than sniffing the network, which can be pretty invasive. (Proxyman “basically performs a MITM attack to see your encrypted traffic.” 🤔)

👉 Pulse: Network Inspector

What I wished iOS had is a simple analog of Safari Web Inspector. So I built just that.

Via iOS Dev Weekly.

Pulse Logo
Software Dev

Getting Started with Instruments

Has there ever been a more powerful, but under-utilised tool than Instruments?

Instruments is a tool included with Xcode that helps you analyze, profile, and debug your live iOS app. Solve memory leaks. Visualize memory. Monitor disk, network, memory, and battery usage. You can even find zombies. 🧟‍♂️

It lets you do incredible things but is also overwhelming to new developers, in which case this Ray Wenderlich tutorial can come in pretty handy.

👉 Getting Started with Instruments

There’s also an Apple WWDC presentation with this same name. 😆

Visual Memory Debugger

Via iOS Dev Weekly.

Software Dev

Motion 💓

This -centric open-source animation library looks promising.

👉 Motion on GitHub

Motion

Motion is an animation engine for gesturally-driven user interfaces, animations, and interactions on iOS, macOS, and tvOS.

I’ve been a little skeptical of open-source animation platforms since I had to toss out one app and then another as cocos2d morphed into cocosd2x and broke everything. Damn that x! But still, this looks cool. 👆

Via iOS Dev Weekly.

Software Dev

The Elm Architecture

I’ve been trying to understand the Elm Architecture for a new iOS project. I kept reading over this article and thinking, “Wait a minute…. What’s the catch here? This seems too simple.” 🧐

👉 The Elm Architecture: Simple, yet powerful – An overview by example

I like that this architecture can be explained in a very short post with examples.

The beauty of The Elm Architecture lies in its simplicity.

That article is simple but assumes a web UI and explicit mentions HTML 🙄. Here is a funnier and more useful article about Elm for iOS. 😂

👉 Elm architecture in iOS: Why you don’t need shit like RxSwift or MVVM

Elm architecture can be described as follows

msg -> Model -> View -> msg

I even made my own diagram just to make sure I “got” it. The devil is in the details, but I think this is right. 🤷🏻‍♂️ It definitely seems simpler than VIPER.

Software Dev

From Nothing to App Store in an Hour

Building, validating, and uploading your iOS app to Apple’s App Store Connect is a surprisingly arduous process. The next time I make an app on my own, I’m totally going to automate the heck out of the process where I can.

This video show how to do it in an hour. 🤯

The lead maintainer of fastlane demonstrates how easy it is to set up fastlane to automate the process of building, signing and uploading your app to the App Store

Via iOS Dev Weekly.

Software Dev

How (The Heck) To Test Push Notifications

You know those notifications you get on your phone from Medium, Nextdoor, or NPR? They’re surprisingly hard to develop and test. A lot happens to get that message onto your phone.

And testing them quickly and thoroughly without impacting people you don’t want to impact can be a challenge. So here’s a little guide to the latest way to test push notifications on iOS.

👉 How to test push notifications in simulator and production iOS apps

abc

Via iOS Dev Weekly.

Software Dev

Syncing Made (Kind of) Easy in Swift

Here’s a pretty amazing series and GitHub repo on mastering sychronizing data across iOS devices.

👉 Replicating Types in Swift

This is a really tough thing to do well, so this series looks incredibly helpful. The central idea is Conflict-Free Replicated Data Types (CRDTs).

I like this teaser under the headline “Where is the server?”

There is no truth — decentral apps rely on trust rather than truth.

Via iOS Dev Weekly.