Fatbobman's Swift Weekly #091
Swift’s Multi-Platform Strategy Requires Collective EffortSeveral months after the Swift forums first announced the formation of an Android Community Workgroup in February 2025, Swift.org has now officially launched an Android Workgroup. This marks the beginning of officially led efforts to support Swift on Android. With this, Swift developers may soon benefit from improved toolchains and a better development experience on Android. However, alongside this excitement, we must also acknowledge a sobering reality: most Swift developers have long operated within Apple’s tightly integrated ecosystem. The APIs we use daily are often deeply coupled with Apple system frameworks. While the Swift community and Apple have made strides—such as the ongoing pure-Swift rewrite of Foundation and the growing number of cross-platform libraries—these efforts still fall short of meeting the broader demands of real-world cross-platform development. Not long ago, the Swift Package Index added compatibility indicators for Android and Wasm, on top of its existing support for Apple platforms and Linux. This reflects a clear intention within the community to promote and encourage multi-platform adoption. I took this opportunity to adapt two of my own libraries for Linux. While the adaptation itself was relatively straightforward—thanks to GitHub Actions for surfacing build errors—the experience revealed a notable lack of a convenient and unified environment for cross-platform development. As support for more platforms becomes necessary, building a robust, safe, and developer-friendly adaptation infrastructure will become increasingly critical. In recent years, Swift’s multi-platform strategy has accelerated significantly. But to truly position Swift as a first-class language for cross-platform development, we can’t rely solely on Apple or the official Swift team. Every Swift developer has a role to play. The stronger Swift becomes, the more we all benefit. Building a thriving, multi-platform Swift ecosystem is a task that calls for collective effort. Previous Issue|Newsletter Archive If you appreciate my work and want to promote your product to the Swift and iOS developer community, sponsoring my blog & newsletter could be an excellent opportunity for you. OriginalNotificationCenter.Message: A New Concurrency-Safe Notification Experience in Swift 6.2
Recent RecommendationsReverse-Engineering Xcode’s Coding Intelligence PromptIn Xcode 26, Apple officially launched the highly anticipated AI coding assistant — Coding Intelligence. Compared to other AI programming tools on the market, does Apple have its own philosophy in designing system prompts? Peter Friese conducted an in-depth reverse engineering analysis using Proxyman. These extracted prompt contents not only shed light on how Coding Intelligence operates, but also reflect Apple’s preferences for modern development practices — such as a strong recommendation to use Swift Concurrency (e.g. async/await, actor) over Combine, and favoring Swift Testing framework and macros for writing tests. These design details serve as important indicators of Apple’s evolving development paradigm. SwiftUI Design System Considerations: Semantic ColorsHandling semantic colors elegantly remains a challenging part of designing SwiftUI APIs. In this article, Magnus Jensen systematically analyzes the pros and cons of common approaches and proposes a macro-based solution aiming for readability, type-safety, and contextual awareness. If you’re working on a scalable and maintainable design system for your SwiftUI project, this is a valuable read. Memory Efficiency in iOSAs project complexity grows, memory issues become inevitable — including leaks, system warnings, or even app terminations due to excessive usage. Diagnosing and managing memory is a true test of a developer’s experience and understanding. In his two-part series, Anton Gubarenko outlines a complete and practical framework for evaluating, diagnosing, and optimizing memory usage in iOS apps. A must-read for developers aiming to build robust and memory-efficient apps. What is @concurrent in Swift 6.2?Recent Swift updates and Xcode 26 make it clear that the Swift team is aiming to improve the concurrency development experience. With new default behaviors, developers can now write safer concurrent code without needing to understand all the fine details upfront. The newly introduced @concurrent attribute is a key part of this effort. In this article, Donny Wals provides a detailed explanation of the background and use cases of @concurrent. Simply put, it allows developers to explicitly mark functions as concurrent under the NonIsolatedNonSendingByDefault mode, signaling that they should run on the global executor — making it easier to offload work from the actor (like the main thread) without blocking it.
Swift 6.2 Java interoperability in PracticeSwift–Java interoperability isn’t new, but past approaches were often complex and error-prone. Swift 6.2 introduces a game-changer — the swift-java package, the first officially supported, toolchain-integrated, and developer-friendly solution for bridging Swift and Java. Artur Gruchała walks through a complete demo project showing how to call Java methods from Swift and build a CLI app combining both languages. He also highlights crucial pitfalls to avoid in real-world development — particularly classpath configuration, which may seem trivial but is vital for success. Migrating to Swift 6 TutorialSwift 6 introduces stricter concurrency rules and a more structured programming paradigm. Understanding isolation domains, Sendable types, default behaviors, and @concurrent usage is essential when migrating. Audrey Tam presents a complete migration tutorial using a SwiftUI example project (with source code), covering everything from Xcode configuration to concurrency semantics and isolation strategies — an extremely practical guide for teams transitioning to Swift 6.2. Modern Concurrency - Swift 6.2 Suite of ExamplesHow do you implement Combine-like throttle with async/await? How do you continuously observe changes to @Observable properties? How do you build a multicast-compatible async stream? In this open-source project, Lucas van Dongen provides a comprehensive set of practical examples demonstrating how to gradually migrate away from Combine and adopt Swift 6.2’s modern, type-safe concurrency patterns in real projects. Considerations for New iOS VersionsApple’s Liquid Glass, introduced at WWDC 25, is visually stunning — but supporting both the new and legacy design paradigms is a major strain on development resources. This raises the question: should you drop support for older iOS versions? David Smith suggests two key considerations: impact on existing users and loss of potential new users. Using real data from his app Widgetsmith, he notes that about 9% of new users still use older systems — meaning raising the minimum iOS version today would immediately exclude them. His advice: wait until the older OS usage drops into the low single digits before making such a move. Simplifying your tech stack shouldn’t come at the cost of significant business impact. Swift 的多平台策略,需要我们大家一起来建设继 2025 年 2 月 Swift 社区论坛发布关于启动 Android Community Workgroup 的消息数月后,Swift.org 于上周正式宣布成立官方 Android 工作组。这标志着由官方主导的 Swift 安卓平台支持正式启动,未来 Swift 开发者有望获得更完善的安卓适配工具链与开发体验。 不过,在欣喜之余,我们也应正视一个现实:对于绝大多数 Swift 开发者来说,长期以来的开发工作深度依赖苹果生态,日常所用 API 多与系统框架强耦合。尽管 Swift 社区和苹果已着手推进 Foundation 的纯 Swift 化改造,并陆续提供更多跨平台基础库,但这距离满足实际跨平台开发的需求仍有相当差距。 不久前,Swift Package Index 在原有对苹果平台和 Linux 的兼容性标识基础上,新增了对 Android 与 Wasm 平台的支持,侧面反映出社区对多平台适配的重视。我也借此机会让自己的两个库完成了对 Linux 的兼容。不过在适配过程中也深刻体会到,目前还缺乏一个便捷、统一的跨平台开发环境。虽然这两个库的适配较为简单,仅通过 GitHub Actions 就完成了编译测试和修复,但若将来需要支持更多平台,社区能否构建一个便利、安全的适配机制将变得至关重要。 近年来,Swift 在多平台战略上的推进明显提速,但若想真正成为跨平台开发者的主流选择,仅靠官方与苹果的努力还远远不够。我们每一位 Swift 开发者的参与同样不可或缺。Swift 越强大,Swift 开发者越受益。Swift 的多平台生态,需要我们共同建设! 如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。 原创NotificationCenter.Message:Swift 6.2 并发安全通知的全新体验NotificationCenter 作为 iOS 开发中的经典组件,为开发者提供了灵活的广播——订阅机制。然而,随着 Swift 并发模型的不断演进,传统基于字符串标识和 近期推荐Xcode Coding Intelligence 逆向解析简报 (Reverse-Engineering Xcode's Coding Intelligence Prompt)在 Xcode 26 中,苹果正式推出了备受期待的 AI 编码助手 —— Coding Intelligence。相较于市面上已有的 AI 编程工具,苹果在系统提示词(system prompt)的设计上是否有自己的哲学?Peter Friese 借助 Proxyman 对其进行了深入逆向分析。通过这些解析出的提示词内容,我们不仅可以了解 Coding Intelligence 的工作机制,也能窥见苹果对现代开发实践的倾向性,比如:强烈推荐使用 Swift Concurrency(async/await、actor)而非 Combine,测试建议使用 Swift Testing 框架与宏。这些设计细节,是苹果开发范式的重要指标。 SwiftUI 设计系统中的语义颜色设计 (SwiftUI Design System Considerations: Semantic Colors)在构建 SwiftUI 设计系统 API 时,如何优雅地处理 语义颜色(Semantic Colors)始终是一个令人头疼的问题。Magnus Jensen 在本文中系统梳理了常见方案的优缺点,并提出了一种基于宏(macro)的解决路径,力求实现 可读性强、类型安全、上下文感知 的色彩系统。如果你正打算为自己的 SwiftUI 项目设计一套结构清晰、可维护的风格体系,这篇文章值得一读。 iOS 内存效率指南系列 (Memory Efficiency in iOS)随着项目复杂度的提升,开发者终将面对内存相关的问题:内存泄漏、系统警告,甚至因资源占用过高被系统强制终止。在这种情况下,如何诊断问题、控制内存占用,是对开发者经验与体系理解的深度考验。Anton Gubarenko 在两篇文章(内存优化篇)中,系统梳理了 iOS 应用内存使用的评估方式、诊断工具以及优化手段,构建出一套完整、实用的内存管理知识体系。 What is @concurrent in Swift 6.2?从 Swift 最近的几个版本更新和 Xcode 26 的表现可以看出,Swift 团队正有意识地优化并发编程的开发体验。通过启用新的默认行为,开发者无需在一开始就理解所有细节,便能写出更安全的并发代码。
Swift 与 Java 互操作 (Swift 6.2 Java interoperability in Practice)Swift 与 Java 的互操作并非新鲜事物,但过往的解决方案往往过程复杂且容易出错。Swift 6.2 引入的 Kodeco 教程:迁移到 Swift 6 (Migrating to Swift 6 Tutorial)Swift 6 引入了更严格的并发规则与更加结构化的编程范式。在迁移过程中,理解隔离域、Sendable 类型、默认行为,以及 Modern Concurrency - Swift 6.2 Suite of Examples如何在 async/await 中实现类似 Combine 的 throttle 操作?如何持续追踪 是否升级应用的最低支持版本?(Considerations for New iOS Versions)WWDC 25 中 Liquid Glass 的登场令人惊艳,但要同时支持两种视觉风格,对开发资源是一大考验。这也让很多开发者开始思考是否应放弃对旧系统的支持。David Smith 建议从两个角度判断:现有用户影响与新用户流失。以他的 Widgetsmith 应用为例,当前仍有约 9% 的新增用户来自旧系统,一旦抬高最低支持版本将直接失去这部分潜在用户。他认为,只有当旧系统用户占比降至个位数时,再做版本升级才更合理——简化技术负担,不应以牺牲业务增长为代价。 活动AdventureX 25 游客指南AdventureX 25 将于 2025 年 7 月 23 日至 27 日在杭州市湖畔创研中心与未来科技城学术交流中心举行。本指南包含活动行程介绍、参与方式、群聊福利、出行与住宿建议及注意事项等内容。不论你是来逛展、互动,还是寻找志同道合的伙伴,这份指南都将帮助你轻松规划行程~ Welcome to my blog Fatbobman's Swift Blog( 肘子的Swift记事本 ) |