Imagine we’re building a mobile shopping app and we are tasked with implementing the products list screen. We’ve got a design specification and we are ready to go. The obvious implementation Most iOS engineers will immediately grab a UITableView , subclass a UITableViewCell , and start implementing the specified layout. struct ProductViewModel { let title : String let price : String let image :…
Imagine we are working on a banking app. This iOS app allows users to access their bank account and view a list of transactions. Since our app needs to be fast and reliable, we’ve decided to log the time it takes to load transactions. Transactions list before logging Our feature code is comprised of a view model, an abstract data-loading interface, and a data-loading implementation. The view model…
If you are new to Swift Concurrency, you are in the right place. Here is everything you need to know in the most condensed form available. The ideal audience of this post is an experienced programmer familiar with concurrency concepts and interested in learning the Swift Concurrency syntax and APIs. Get comfy, because we have a lot of ground to cover. Async/await syntax Asynchronous functions are…
Most developers and companies building iOS apps want to have insights into the usage of their apps and get detailed reports when their app crashes. There are many solutions on the market, but Firebase Analytics and Crashlytics services are common choices because they are very well known and can be used for free. When integrating these services, an important topic to have in mind is user data…
John Sundell recently wrote an article on the topic of categorizing and naming protocols in Swift . As I was reading it, I realized I had a different take on several ideas shared in the article. But before I go into the details, I’d like to say that I’m a big fan of John’s work. The first thing I saw from John was his conference talk on system design . Afterward, I started listening to his podcast…
I recently worked on a project with a goal to consolidate and standardize localization efforts in a sizeable iOS application written in Swift. This app uses a 3rd party localization service that supports Over-The-Air (OTA) localization. In short, it means that the live app can fetch the latest localizations from the server and there is no need to resubmit the app to the App Store to update the…
After years of building, researching, experimenting, and iterating on iOS application architectures, I’ve gathered my learnings and conclusions so far into a single document. This is a document I would love to have had when I first started developing iOS applications. It goes beyond standard architectural patterns like MVC, MVVM, and VIPER, which you are most likely to stumble upon in the iOS…
Buttons can sometimes be difficult to distinguish from labels in the iOS interfaces with a lot of text. One way to make a button more noticeable is to add a border with a rounded corner to a UIButton view. Here is a complete RoundedBorderButton class you can use to achieve the same effect: The class is using @IBDesignable and @IBInspectable attributes to enable you to modify the border properties…
To create a serial queue, normally you would write something simple like this: let queue = DispatchQueue(label: “com.mydomain.myqueue") If you wanted to define a priority for that queue, you could have done that by retrieving a global queue of the required priority and setting it as a target . But that’s the old way to do it and it doesn’t work in Swift 3 . Since Swift 3, once a dispatch queue is…
I was evaluating some libraries to include in the project and their size was considerably big. So I wanted to know how would that new library affect the size of my app. But I didn’t even know what’s the current size of my app. To find that out, there were a couple of things I checked: size of the project folder: 41MB size of the archive that is uploaded to the App Store: 184MB size of the app…