Using SwiftGen and [Phrase]

Photo by JACQUELINE BRANDWAYN on Unsplash

In this article, I’ll show you one of my favorites Localization flows I use for iOS applications. As you might already know, localization is an essential part of almost every iOS app but unfortunately, it’s usually relegated to later phases where sometimes it’s too late, thus very expensive and hard to refactor. With this flow that I am about to elaborate on(as well as many others on the internet), it’s possible to easily isolate what is happening on the localization side (pulling strings, generating constant files, and others), and also make the maintenance smoother and more error-prone. …


Photo by Jeffrey Brandjes on Unsplash

Having done a few animations with SwiftUI, I have realized how tough it is to use the withAnimation() modifier on multiple properties and views at different times or sequentially. Besides, when it comes to moving views around in a very particular way withAnimation() may lack clarity, extensibility, and sometimes organization. That’s why I’m going to show you the AnimationSequence framework I’ve written that wraps the beauty of SwiftUI.Animation and declutters our code a bit. Let’s dive into it.

1 — Current scenario

This is what I normally find when looking for tutorials on Google or YouTube on how to animate views sequentially. …


Photo by Aron Visuals on Unsplash

Coding an iOS app almost always involves parsing data from a backend response or a JSON file into the structures or the classes of our domain, thus, decoding data should be as clean, error-prone, and transparent as possible.

The problem

// 1. Parsing the json (wherever it comes from) to data
let jsonData = JSON.data(using: .utf8)!
// 2. Decoding the data to the actual structure
let fact = try! JSONDecoder().decode(CatFact.self, from: jsonData)

This is the “most” common way to do it, however, these two lines are force-unwrapping the values, a practice not recommended in production due to the “unexpected” crashes that can…


Photo by Glenn Carstens-Peters on Unsplash

Many times in iOS development, we come across the task of sorting an array, and then we write a piece of code like the following, in any place of our app where it’s needed. Notice that the array of animals is not defined yet, neither is the Animal structure, but don’t worry, they will be specified later on in this article.

animals.sorted { (left, right) -> Bool in {
return left.id > right.id
}

1. The problem

What if, instead of sorting the array of animals by id, now we need to sort it by name or any other property the Animal has…

Cristhian Leon

Curious, passionate iOS Developer, interested in ML, and clean code principles.

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