When developing an app, we might need to add some custom logic when a
UIView is loaded. For example, we may need to perform a network call to fetch some data from the backend. On other occasions, we may need to clear up some resources when the view is about to be dismissed and hidden from the user.
Although these ideas are simple, there are a few nuances in iOS development. It may be helpful to explore them together.
Last week, we started a new project where we implemented a very basic calculator application from the command line.
We developed that project to explore the ArgumentParser library provided by Apple that gives us automation to read the input of the user from the standard input.
This week, we will dive deep into some more advanced features. Before starting, I suggest taking a quick look at last week’s code to refresh some concepts.
Our app is using the Comand pattern as the main architectural style. Whenever we need to add a new command, we know we have to extend the…
Swift is a well-rounded language, and it is becoming more used every day. Its main usage is for iOS and macOS apps, but it is used also for scripting, command line tools (CLI), and even for backend and web development.
In this article, I’d like to explore a library provided by Apple to create a CLI application: the Swift Argument Parser. This library encapsulates the logic of parsing the input of the user when issuing a command in the Terminal. The library does that by using property wrappers. The Swift’s type system makes everything safe.
Thanks to this library, we…
For every story, there are always two sides. Last week, we talked about how to prepare a good PR. Today, I’d like to talk about how to perform a good code review.
Code reviews are a very important part of every developer’s day. The two main goals of a code review are to:
Additionally, it happens quite often that the reviewer learns something new in the process of performing the code review. …
Creating a PR and waiting for a code review is a standard approach to writing code. PRs and code reviews are very important in every developer’s day. They achieve different goals:
The process is usually split into two steps: A developer prepares a PR and another developer (or several) performs a code review, pointing out the good parts and the parts that can be improved.
Today, I’d like to go through the first step, highlighting how we can create a PR…
If you follow my blog, you’ll know that I love concurrent programming. I’m very fascinated by the idea of running different tasks at the same time, collecting the results, and saving a ton of time.
This week, while working on my team's current project, I discovered a new API that I was not aware of:
DispatchQueue.concurrentPerform. This small and nice API lets us run batches of work together and will handle all the concurrency for us.
Let’s explore it together.
When working with a new API, the first thing to do is to read its documentation:
SwiftUI is becoming more mature every day, but UIKit is here to stay. This is something that already happened in the past with other technologies. Swift, for example, was released in 2014, but there are many apps out there that are still written and maintained in Objective-C.
UIKit offers several components to build our apps, but sometimes their APIs are not as flexible as we would like. Sometimes those components work weirdly and we struggle to change their behavior. Have you ever tried to implement a custom animation for a
UITabBarButton, for example?
In today’s article, I’d like to share…
A good software engineer is not just a person who can solve problems efficiently writing software. They are people who can write code that is robust, easy to read, and easy to maintain more than writing smart one-line solutions.
Good software engineers spot where they can simplify the code, use patterns, or refactor pieces of code to make them better.
Let’s explore five of my favorites ways to write cleaner and more meaningful code in Swift.
guard keyword is one of the most defining of the Swift programming language. …
Concurrency and asynchronicity are two big topics in any app. We use asynchronous code every day for network requests and other operations, and we need to master it.
Concurrent programming is a more hidden topic, but it can pop up in any app as well. What if we develop an image-processing app and we want to apply different filters to different images at the same time to create a collage? With concurrent development, we don’t have to wait for all the filtering to complete sequentially. If we apply all the filters at the same time, we can wait only for…
After releasing a project, we want to add new features, A/B test some other features, and remove old features that no longer make sense.
All these interventions belong to the evolution process of a project. They fall in the adaptive maintenance and perfective maintenance categories. In some other cases, we need to intervene to fix a bug that is affecting our users. This intervention belongs to the corrective maintenance sphere.
What do all these changes have in common? They are all maintenance interventions that change the code base. …
Hi everybody, I’m Riccardo. Senior iOS Engineer at Bending Spoons, I breathe iOS development: apps and tools. I love to share my knowledge with others.