Weekly Comment
On March 30th to 31st, 2024, I was fortunate to attend the Let's VisionOS 2024 conference in Beijing. This grand event, being the world's first large forum dedicated to VisionOS development, attracted distinguished guests and developers from all corners of the globe. Throughout the conference, speakers generously shared their professional techniques, valuable experiences, design philosophies, and insightful analyses of future trends in the VisionOS development field.
Due to the pandemic, community-led exchange activities in the Apple development sphere had been interrupted for a while. Thanks to the persistent efforts of the organizers, SwiftGG and XReality Zone, not only was this event a complete success, but it also set an excellent example for future offline gatherings within the Chinese Apple developer community.
The in-depth discussions held at this conference with developers from various regions and fields sparked new ideas, creative inspiration, and potential collaborations. I firmly believe this embodies the true value of offline events.
Looking forward, I hope that China's developer community will host more events of this caliber. At the same time, I encourage every developer to cherish the opportunity to participate in global events, immerse themselves fully, and enjoy the joy and growth these events bring.
Previous Issue|Newsletter Archive
If you find this weekly newsletter or my blog helpful, I would greatly appreciate your consideration of making a donation through Patreon, or Buy Me a Coffee.
Originals
SwiftUI Views and @MainActor
An increasing number of developers are starting to enable strict concurrency checks in preparation for the arrival of Swift 6. Among the warnings and errors received, a portion relates to SwiftUI views, many of which stem from developers not correctly understanding or using @MainActor
. This article will discuss the meaning of @MainActor
, as well as tips and considerations for applying @MainActor
within SwiftUI views.
Recent Selections
Writing GNOME Apps with Swift
In recent years, the Swift community has actively promoted the application of the language across various platforms. However, due to the lack of suitable UI frameworks, it has been less utilized in building desktop applications on non-Apple platforms. Adwaita for Swift enables developers to construct user interfaces for the GNOME environment in a manner similar to SwiftUI. In this article, David Swift shows us the potential of developing Linux desktop applications using Adwaita for Swift, sharing a practical code example. The author also warmly invites readers to participate in all aspects of the Adwaita for Swift project, including app development, issue submission, documentation writing, and joining discussions, to collectively advance the project.
Dependency Injection for Modern Swift Applications Part II
In this article, Lucas van Dongen delves into the application of four main Dependency Injection (DI) strategies in modern Swift app development, including manual tree-based dependency management, EnvironmentObject
, the Factory pattern, and the Needle framework introduced by Uber. Considering key aspects such as compile-time safety, generational safety, scalability, usability, and testability, the author thoroughly compares the strengths and weaknesses of each method. The article suggests that the Factory pattern is a good choice for smaller projects, while larger projects might benefit more from adopting a framework like Needle to ensure high scalability and safety. For projects in their early stages, using Environment
or Singleton could serve as a flexible temporary solution, gradually transitioning to a more structured DI approach as the project evolves.
Although this article is a follow-up in a series, its content is designed to be read independently, offering readers a complete insight.
10 ½ Advanced App Store Optimization Secrets ASO Experts Will Never Share!
In this article, Ariel Michaeli shares a series of advanced App Store Optimization (ASO) strategies, including promoting in-app purchases, implementing in-app events, paying attention to the use of special characters, optimizing keyword layouts, accurately handling multi-word keyword combinations, and gaining a deep understanding of competitors. These strategies aim to significantly increase an app's visibility on the App Store and Google Play. Michaeli notes that although many developers have mastered the basic skills of ASO, these advanced techniques offer opportunities for optimization beyond the basics, potentially making your app stand out significantly from the competition.
Iterating Over Web Socket Messages with Async / Await in Swift
Using for try await line in url.lines
, developers can retrieve data from a URL line by line, providing significant convenience. However, this method is not suitable for establishing WebSocket connections and listening for incoming messages. In this article, Donny Wals discusses how to construct a dedicated mechanism that allows developers to asynchronously iterate over WebSocket messages. Wals not only provides an efficient method for handling WebSocket messages but also paves new pathways for developers seeking to implement more complex communication patterns in Swift applications.
Our Apple Sports design critique
In this article, Sam Gold analyzes Apple's newly launched app designed specifically for sports enthusiasts - Apple Sports. Starting from a design perspective, the article explores how the app ingeniously integrates and reimagines standard UI components, delves into the extensive use of gradients, the meticulous design of text, and the striking dynamic background effects. Through the discussion of these design details, Gold attempts to uncover the potential design trends of iOS 18.
Develop in Swift Tutorials
Apple has recently launched a new interactive tutorial - "Develop in Swift". This tutorial covers the basics of SwiftUI, SwiftData, and VisionOS, providing beginners with a comprehensive introductory experience. Even experienced developers can find new learning opportunities and inspiration within these tutorials. Whether you are a programming novice or a seasoned developer looking to expand your skills, the "Develop in Swift" tutorials are well worth exploring.
肘子的话
在 2024 年 3 月 30 日至 31 日,我有幸在北京出席了 Let's VisionOS 2024 大会。这场盛会作为全球首个专注于 VisionOS 开发的大型论坛,吸引了来自四面八方的杰出嘉宾和开发者。会议期间,各位嘉宾不吝分享他们在 VisionOS 开发领域的专业技巧、宝贵经验、设计哲学以及对将来发展趋势的深入洞察。
受疫情影响,社区主导的苹果开发领域的交流活动曾一度中断。感谢 SwiftGG 和 XR 基地 主办方的坚持和努力,这次活动不仅圆满成功,还为中国苹果开发者社区未来的线下聚会树立了优秀的典范。
在此次大会上,与来自不同地域和领域的开发者进行的深入探讨,激发了新的思维火花、创意灵感和合作机会。我深信,这正体现了线下活动的真正价值。
期待未来,中国的开发者社区能够承办更多此类精彩活动。同时,我也鼓励每位开发者珍惜参加全球各类活动的机遇,全心投入其中,享受这些活动带来的乐趣与成长。
秀出你的愿望单
推文 地址
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
SwiftUI 视图与 @MainActor
越来越多的开发者开始尝试开启并发严格检查选项,为 Swift 6 的到来做准备。在收到的警告和错误中,有一部分是与 SwiftUI 的视图有关,其中很多都是由于开发者没有正确的理解和使用 @MainActor
造成的。本文将聊聊 @MainActor
的含义,以及在 SwiftUI 的视图中应用 @MainActor
的技巧和注意事项。
近期推荐
Writing GNOME Apps with Swift
近年来,Swift 社区积极推进该语言在各个平台上的应用,但由于缺少适合的 UI 框架,其较少被用于在非苹果平台中构建桌面应用。Adwaita for Swift 使开发者能够以一种类似于 SwiftUI 的方式,为 GNOME 环境构建用户界面。在本篇文章中,David Swift 向我们展示了使用 Adwaita for Swift 开发 Linux 桌面应用的潜力,并分享了一个实际的代码示例。作者还热情地邀请读者参与到 Adwaita for Swift 项目的各个方面,包括开发应用、提交问题、撰写文档以及加入讨论,共同推动项目前进。
Dependency Injection for Modern Swift Applications Part II
在本篇文章中,Lucas van Dongen 深入探索了四种主要的依赖注入(DI)策略在现代 Swift 应用开发中的应用,这四种策略包括手动树形依赖管理、EnvironmentObject
、工厂模式以及 Uber 推出的 Needle 框架。通过考量编译时安全、代际安全、扩展性、易用性及可测试性等关键维度,作者详细比较了各种方法的优劣。文中提出,对于规模较小的项目,工厂模式是一个不错的选择,而对于规模较大的项目,则可能需倾向于采用 Needle 这样的框架来确保高度的可扩展性与安全性。对于正处于初期阶段的项目,采用 Environment
或单例可能是一种灵活的暂时方案,随着项目的发展,再逐步迁移到更加结构化的 DI 方案。
尽管本文是系列文章的后续,但其内容设计为可以独立阅读,为读者提供了完整的见解。
10 ½ Advanced App Store Optimization Secrets ASO Experts Will Never Share!
在这篇文章中,Ariel Michaeli 分享了一系列 App Store 优化(ASO)的先进策略,包括推广应用内购买、实施应用内事件、注意特殊字符的使用、优化关键词布局、精确处理多词关键词组合、以及深入了解竞争对手等。这些策略旨在显著提升应用在 App Store 和 Google Play 上的曝光率。Michaeli 指出,尽管许多开发者已经掌握了 ASO 的基本技巧,但这些进阶技巧提供了超越基础层次的优化机会,可能会令你的应用显著区别于其他竞争产品。
Iterating Over Web Socket Messages with Async / Await in Swift
使用 for try await line in url.lines
开发者可以逐行从 url 中获取数据,尽管这为开发者提供了极大的便利,但这种方法并不适合于建立 WebSocket 连接及监听传入的消息。在本文中,Donny Wals 探讨了如何构建一个专门的机制,允许开发者异步地遍历 WebSocket 消息。Wals 不仅提供了一个高效处理 WebSocket 消息的方法,也为那些寻求在 Swift 应用中实现更复杂通信模式的开发者们开辟了新的路径。
Our Apple Sports design critique
在这篇文章中,Sam Gold 分析了 Apple 最近推出的、专为体育爱好者设计的新应用——Apple Sports。文章从设计维度出发,探讨了该应用如何巧妙地融合并重塑了标准 UI 组件,深入解析了渐变色的广泛应用、精细的文字设计以及引人注目的动态背景效果。通过这些设计细节的讨论,Gold 试图揭示出 iOS 18 可能倾向的设计趋势。
Develop in Swift Tutorials
苹果公司最近推出了新的交互式教程——《Develop in Swift》。这个教程涵盖了 SwiftUI、SwiftData 以及 VisionOS 的基础知识,为初学者提供了一个全面的入门体验。即便是经验丰富的开发者也能在这些教程中找到新的学习机会和灵感。无论你是编程新手还是希望扩展技能的资深开发者,《Develop in Swift》教程都值得一探。