iPad Pro Order Page

Apple announced iPadOS 15 during WWDC 21 and — to put it mildly — this wasn’t the iPadOS I was looking for.

Time to move along.

False expectations

To understand exactly what it was I was looking for, and why, we need to go back in time to Apple’s “Spring Loaded” event.

As you’re no doubt aware, last April Apple announced that they were taking the same M1 Apple Silicon chip that powered the new MacBook Pro, the MacBook Air, the Mac mini, and the iMac… and that they were putting it into their brand new iPad Pro.

Photo by Adrià Tormo on Unsplash

In a recent article, Using Data Transfer Objects (DTO) in Swift Code, Steven Curtis makes an argument for using DTO’s in Swift code as a standard practice. I disagree with that premise, and in this article I hope to demonstrate why.

Domain Models and Domain Transfer Objects

First, we need to define our terms. Here I’m going to borrow from Steven so that we’re on the same page…

If we think about the clean code architecture we may come to understand that, for simple applications domain models may closely resemble network and storage models. However, they have differences

Domain Model: Structure is chosen for suitability for…

From what I gather, you're adding objects primarily for Separation of Concerns.

Okay... I get that. But adding another object means that I now have to write code that maps data to and from the model to the domain object. So the question here is that did the benefits of the separation outweigh the disadvantages of writing more code? Code that could, in fact introduce its own set of bugs into the project.

As I tend to hate writing boilerplate code, my initial response to that question is no, it does not.

Second, another stated reason for introducing said objects…

Photo by Safar Safarov on Unsplash

I’m heavily into SwiftUI. I like writing it. I like learning it. I like reading articles about it. I like puzzling out its internals and behaviors.

Basically, I’m a SwiftUI geek.

So, I was reading an article and one of the readers commented that they were seeing some unexpected behavior when they tried implementing the proposed solution in their own app.

What behavior? Glad you asked.

Understanding NavigationLink

It dealt with using NavigationLink. Check out the following code:

This is an extremely simplified version of the main menu screen from the iDine app I’ve used to illustrate various SwiftUI features in…

Wizard of Oz, 1939, Image courtesy of MGM

When SwiftUI works it’s a wonderful, magical thing. And then there are the times when I feel like the man hidden behind the curtain, frantically spinning knobs and throwing levers in a desperate attempt to keep the illusion going.

Take today, for example. SwiftUI provides a set of delightfully simple mechanisms for manage editing, deleting, and rearranging items in a SwiftUI List. Just add a couple of action handlers and trigger the whole thing with the built-in EditButton.

What could go wrong?

Well, as we saw with SwiftUI and the Missing Environment Object… plenty.

Let’s start with the problem

It seemed so easy. I wanted…

For each value received, our closure { } will translate that value into an Observable that will return two values of its own.
For each value received, our closure { } will translate that value into an Observable that will return two values of its own.
Illustration via ReactiveX docs

One of the most powerful operations in the ReactiveX arsenal is FlatMap. And yet for many people, it’s also one of the hardest operators to get your head around.

Today we’re going to take a deep dive into FlatMap, and by the time we’re done, you’re going to know exactly how it works, when to use it, and how to avoid some of the traps that surround it.

In order to do that, we’re going to take a look inside some of the RxSwift operators. …

Balloon Pop by KellyJane on DeviantArt

During WWDC 2015 Apple dropped a small bombshell on the Swift development community during a session titled “Protocol-Oriented Programming in Swift”. In it Apple demonstrated just how Protocol-Oriented Programming (POP) could free us from the constraints of traditional class-based object hierarchies.

Swift hasn’t been the same since.

Then, just over a year ago during WWDC 2019, Apple dropped another nuke and introduced SwiftUI — its proposed user-interface replacement for the ever venerable UIKit and AppKit.

There’s just one problem.

SwiftUI and Protocol-Oriented Programming don’t get along very well.

To see why, let’s start with an example.

SwiftUI and the ObservableObject

Say that we’ve begun…

Photo by Douglas Sanchez on Unsplash

SwiftUI gives us an amazingly concise declarative approach to programming our user interfaces. Consider the following code:

struct SomeHeaderView: View {
var text: String
var body: some View {
HStack {
Image(systemName: "star")
.foregroundColor(Color(red: 88, green: 86, blue: 214))
.foregroundColor(Color(red: 89, green: 86, blue: 214))

Here we use view decomposition to build a customer header view for our application that anyone can include and use in their own views. The image and text in our headers use a title font with some custom modifiers, and they use our application’s brand color.

But we have a…

RxSwift logo
RxSwift logo
New RxSwift 6.0 logo via RxSwift GitHub Project

It’s a new year (finally), and with it, we have a new version of RxSwift.

Version 6.0 brings quite a few new features and changes to the table, but the one I want to discuss today is withUnretained and how it solves — and fails to solve — one of the most common problems in our RxSwift code.

Weak Self and Retain Cycles

Consider the following code:

Subscribing to an observable and handing off the result to a class method is an extremely common occurrence in RxSwift. Unfortunately, it’s prone to retain cycles when used inside of class instances, which is why we’re constantly…

So let’s cut to the chase. Geekbench test scores from a “MacBookAir10,1,” reveals a single-core score of 1687 and a multi-core score of 7433. The 8-core processor was clocked at 3.2 GHz.

Which has Apple’s new ASi M1 chip blowing past all mobile Macs, all current Mac mini configurations and even a healthy portion of the iMac desktop specs.

And that includes the late-2019 MacBook Pro with the Intel Core i9–9980HK processor clocked at 2.4 GHz.

So their lowest-end MacBook Air with ASi beats the eight-core Intel Core i9 used in the high-end 16-inch MacBook Pro.

My current machine.


Michael Long

Michael Long is a Senior Lead iOS engineer at CRi Solutions, a leader in cutting edge iOS, Android, and mobile corporate and financial applications.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store