Weekly Comment
Welcome readers to the brand new year of 2024! First of all, I sincerely wish each and every one of you a happy new year, filled with happiness and success.
Looking back at 2023, I have briefly summarized my achievements in writing. In that year, I wrote a total of 34 blog posts, covering a diverse range of topics.
Among the articles I published in 2023, the top five most popular ones among English readers were (according to Medium’s statistics):
- A Deep Dive Into Observation: A New Way to Boost SwiftUI Performance
- Deep Dive into the New Features of ScrollView in SwiftUI
- GeometryReader: Blessing or Curse?
- WWDC 23, First Impressions of SwiftUI 5 and SwiftData
- Mastering ViewThatFits
For Chinese readers, the five most popular articles are (Blog + Juejin + Zhihu + WeChat):
- Layout in SwiftUI Way
- MacBook Pro Usage Experience
- Customizing the Appearance and Interaction Behavior of Buttons
- Cracking the Code: The Mysterious @State Injection Mechanism
- WWDC 23, First Impressions of SwiftUI 5 and SwiftData
And the five articles that I put the most effort into in 2023 are:
- Concurrent Programming in SwiftData( total of 3 )
- Mastering TipKit( total of 2 )
- The Secret to Flawless SwiftUI Animations: A Deep Dive into Transactions
- GeometryReader: Blessing or Curse?
- iCloud Documents( total of 2 )
Starting from 2024, all my articles (including both Chinese and English versions) will only be published on my blog (Medium will stop updating on April 1st). I hope that in the new year, I will be able to create more high-quality content, not only sharing knowledge but also continuously improving myself in the process. Once again, thank you for the support of all readers, and I look forward to continuing our journey together in the future!
Originals
Blog Update Chronicle: Welcoming 2024 with a New Blog
Over a month ago, I embarked on a bold plan: to completely reshape my blog site with the assistance of artificial intelligence. Finally, as we approach the end of 2023, this brand new version of the blog has come to life. This article will briefly review the journey of this blog update, documenting the key steps and personal insights along the way.
Recent Selections
Swift C++ Interop
Swift 5.9 introduces bidirectional interoperability support between Swift and C++. This advancement allows the generation of C++ header files, enabling the exposure of Swift APIs in a C++ interface-like manner. It greatly simplifies the process of integrating Swift into existing C++ code, which has been a key development focus for the Swift team in recent years.
In this article, zonble shares his experience and insights in attempting to merge Swift and C++ in practical work. He points out that although Swift C++ interoperability is feasible to some extent, it is currently not mature enough to be fully applied in practical work. It may still be necessary to utilize Objective-C as an intermediate layer before Swift fully supports C++.
AsyncPhoto for displaying large photos in SwiftUI
Although SwiftUI has provided the AsyncImage view since iOS 15, the limitations of its functionality and flexibility still drive developers to seek additional third-party solutions for better image retrieval and display. To address this challenge, Toomas Vahter introduces his custom AsyncPhoto view for SwiftUI in his two-part article. This solution is designed specifically for displaying large photos and offers a wider range of flexibility, supporting image loading from various data sources and allowing for custom image processing and display. The introduction of AsyncPhoto provides an efficient and flexible new option for image display in SwiftUI.
Interesting Facts About Apple iOS App Distribution and Installation
This article mainly introduces some interesting things and historical evolution in the distribution and installation process of Apple iOS applications. iHTCboy talks in detail about how Apple has developed its application distribution ecosystem, from the period when Apple initially launched iPhoneOS without support for native app development to the later introduction of the App Store. The article explores different developer programs and distribution methods, such as enterprise signing, super signing, TestFlight signing, and MDM super signing, as well as developer mode, enterprise accounts, and device registration restrictions. Additionally, the article also covers solutions for distributing custom and non-public apps, and discusses the potential impact of the EU’s Digital Markets Act on Apple’s software ecosystem. The article provides readers with a comprehensive and in-depth understanding of the distribution and installation process of Apple iOS applications.
Comparing Swift Compiler Performance on Type Inference Part I
In this article, Lucas van Dongen explores the performance of the Swift compiler in terms of type inference, with a particular focus on the impact of different initialization methods on compilation speed. The article begins with a challenge the author faced in his work: a code block in the application he was responsible for maintaining exceeded the 1000 millisecond limit for compilation time, resulting in failed continuous integration (CI). He discovered that the problem stemmed from the use of .init()
in the code, which significantly slowed down the compilation speed. The article thoroughly analyzes the specific impact of different initialization methods for various types (such as strings, numbers, arrays, and dictionaries) on the performance of the Swift compiler. Additionally, the author shares a series of benchmark tests to demonstrate the performance comparison of different versions of the Swift compiler.
The Journey of Investigating the Loss of Swift Runtime Symbols in Dynamic Libraries
DanceCC is the brand name of a compilation toolchain for ByteDance’s Mobile Infra, based on Swift.org’s toolchain. It includes customized debugging optimization, custom Clang plugin features, and self-developed passes for package size and performance optimization, among other things.
This text starts with a specific technical problem: after adopting the latest toolchain from DanceCC, an application crashes upon startup. The author, DreamPiggy, accurately identifies the core issue through in-depth technical analysis – the loss of critical symbols from the Swift Runtime in the dynamic link library. The article thoroughly documents the author’s troubleshooting steps, particularly the meticulous examination of the visibility attributes of the compiler-generated symbols. After a deep analysis of the problem, DreamPiggy proposes a temporary solution and further shares methods for a profound fix, including modifying the source code to ensure the correct visibility of symbols.