Head of Mobile Any.do, Author of “Pro iOS Testing”

Confession

I have a confession I want to begin with — before adopting any new technology or design pattern, I need to understand its benefits and problems.

While it may sound reasonable, this behavior was holding me back in some important areas over the years.

For example, it took me almost…

Replicate UIKit Drag and Drop in SwiftUI

Those of you who are familiar with UIKit iOS 11 Drag and Drop API probably know that it dramatically improves UITableView and UICollectionView reordering user experience.

“Drag and Drop” become super straightforward, and the API handles most of the cases itself.

But what happens with SwiftUI? Do we have the…

Animations in UIKit are doable, but SwiftUI can make the process a lot more convenient

Paint splattered across the floor
Photo by Ricardo Viana on Unsplash.

Not only do iOS animations feel and look great, but they are also very easy to create. So how do I have the nerve to say that they are “messy”?

To understand that, let’s go back to the early days of iOS development — when we wrote code in Objective…

UICollectionView and UIViewControllerTransitionDelegate can teach us a lot on how to design a significant separation in our code

Introduction

UICollectionView and UIViewControllerTransitionDelegate are with us for a long time already. Both of them solved some critical issues iOS development had with flexibility and customization of user experience.

What’s more interesting is that both of them provide a great example of how to create a flexible design pattern that lets…

Better collection views with backwards compatibility

Yes, you can still support old phones. (Photo by Bagus Hernawan on Unsplash.)

Introduction

If you make heavy use of tables and collection views, iOS 13 brought something great for you — DiffableDataSource. If you’re not familiar with it, you’re more than welcome to read my (excellent!) tutorial about how to implement it into your project.

Anyway, in short — DiffableDataSource is a way…

A look at what happens when you break down a String

Photo by Pro Church Media on Unsplash

Notes

Although we expect String slicing to be a common task in software development, many Swift developers find substring to be complicated and frustrating.

Comparing Substring in Other Languages

Let’s see how substring works in other computer languages:

C++: str.substr(2,8)
Java: str.substring(2,8)
Python: str[2,8]
Objective-C: [str substringWithRange:NSMakeRange(2,6)]

Now let’s see how substring works in Swift:

var…

Avi Tsadok

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