Great articles this week
1. Making illegal states unrepresentable
The collection Type-Driven Design with Swift
by Alex Ozun is a great collection about how to make a type-safe API design.
This article is a part of the collection, and it explains how to make illegal states unrepresentable in Swift. The author explains the concept of illegal states, and how to use Swift type system to make illegal states unrepresentable. The article also provides some examples of how to apply this concept in Swift.
swift-tagged is a library that also built to apply type-safe API design as well.
2. The evolution of iOS Performance Optimization
This is a interesting article from Dai Ming that summarizes several important aspects of iOS performance optimization: crash, slow launch, app size, memory issue, … He mentioned about the problems, root causes and solutions for each aspect that we should consider when optimizing the performance of an iOS app.
3. Deep dive Proton VPN
This article from Emerge team take a detail look at Proton VPN iOS app size.
Some interesting points from the article:
- Proton VPN triplicate Alamofire library in 3 targets by using static library, but due to Dead code stripping, the total size is smaller than using 1 dynamic Alamofire library.
- The duplicate of assets in 3 targets is huge, and this kind of mistake is common in even big iOS projects. Please analyze carefully for assets in your project. More infor can be found at these 2 great articles:
4. Copilot for Xcode — The Heist of the Century
Last week I took a look at CopilotForXcode source code, and I found that this project has a great codebase, a good architecture, and a lot of things that I don’t know about it yet. I started deep dive into it, and I will write more articles that explain how it works under the hood.
Meanwhile, this article from Paul Bancarel explains the high level architecture of Copilot for Xcode, and explain the mechanism how Github Copilot can implement the inline completion in Xcode.