
My Code, My Rules
I suspect many developers who use AI agents to build their projects now rarely review AI-generated code line by line. Instead, their sense of control over a project comes largely from a set of written rules. As the project grows, so does the feeling of detachment from the codebase. When you want to step in and take matters into your own hands, you may find yourself unsure where to begin.
As a developer who wants my code to retain a personal style even when I don’t write it myself, I’ve been looking for a way to leave my own imprint on my projects. This isn’t just about maintaining a sense of involvement. I also believe that, in many scenarios, I still possess capabilities that AI cannot yet replace.
Fortunately, while working on my little app recently, I found a way to weave my personal style and technical ideas more naturally into the project. Judging by the results so far, I’m quite pleased with how it has worked out.
As a blogger, I’ve written hundreds of technical articles over the past few years. As a newsletter editor, I’ve also recommended hundreds of excellent pieces based on my own technical judgment and preferences. During development, whenever AI’s implementation drifts from what I have in mind, I often give it posts I’ve written, libraries I’ve developed, or articles I’ve thoroughly read and recommended, asking it to use the ideas they contain as a reference. Compared with dry sets of rules, complete articles and source code often come with rich context, design motivations, technical trade-offs, and concrete examples. This makes it easier for AI to grasp the intent behind my requests.
As a result, even though the code in my project is now the product of several different AI models, I can still clearly see my own fingerprints throughout the codebase. This doesn’t mean that my ideas are necessarily superior to the solutions AI would come up with on its own, but that sense of familiarity has helped me reconnect with the code. I may not have written it myself, but many of the technical decisions behind it are still mine.
To preserve this sense of control, perhaps one of my goals going forward will be to keep producing content that reflects my personal style, technical judgment, and design philosophy.
For developers more broadly, now that AI has significantly improved coding efficiency, could we use the time saved to broaden our technical horizons, explore alternative approaches, and organize and document our own experiences and ideas? These efforts can help us sharpen our own technical judgment and, in turn, guide AI toward better implementations.
In the future, humans may no longer be the sole audience for technical writing. Beyond helping readers understand an author’s ideas, ensuring that AI can also accurately interpret those ideas and put them into practice will become an important consideration in the writing process.
Previous Issue|Newsletter Archive
📢 Sponsor Fatbobman’s Swift Weekly
Promote your product to Swift & iOS developers across:
- Blog: 50,000+ monthly visitors
- Newsletter: 5,000+ subscribers, 50% open rate
Perfect for developer tools, courses, and services.
Enjoyed this issue? Buy me a coffee ☕️
Recent Recommendations
ActorRPC: An Experiment with Swift Distributed Actors over HTTP
Although Swift’s Distributed Actors have been around for several years, their typical use cases have largely centered on stateful distributed clusters within data centers, making this language feature feel somewhat distant to most Swift developers. Recently, Simon Leeb leveraged the newly added support for Distributed in Embedded Swift on Swift’s main branch to build ActorRPC, an end-to-end RPC proof of concept written entirely in Swift. It demonstrates another possibility for this feature: bringing a type-safe full-stack development experience to Swift, similar to what tRPC offers in the TypeScript ecosystem.
In the author’s online treasure hunt game, the frontend is written in Embedded Swift, compiled to Wasm, and runs in the browser, invoking a distributed actor deployed on AWS Lambda through ordinary JSON POST requests. The frontend and backend share a single @Resolvable protocol as their API contract, without requiring additional schema definitions or code generation. The entire solution requires no cluster management mechanisms, can take full advantage of existing HTTP infrastructure, and can integrate with server-side frameworks such as Vapor and Hummingbird.
What I find most interesting about this project is that the value of Distributed Actors lies not only in enabling actors to operate across process boundaries, but also in the language-level, type-safe remote invocation mechanism already provided by the Swift compiler. Even developers who have no need for a distributed actor system in the traditional sense can take advantage of this capability on its own.
A ‘Weak’ Too Far: Debugging a Swift Miscompilation
When refactoring Swift code, many developers habitually retain [weak self] even after a closure becomes non-escaping, assuming that an extra weak reference can’t hurt. In this article, Matthias Gansrigler-Hrad recounts a frustrating debugging experience: a piece of perfectly valid code, containing an unnecessary [weak self], triggered a compiler bug under Release optimizations in Swift 6.4.2 (Xcode 27.2), causing the app to crash at guard let self. Yet the crash was impossible to reproduce in Debug mode.
With AI-assisted analysis of the disassembly and SIL, Matthias eventually traced the problem to an optimization mechanism in the Swift compiler. To reduce heap allocations, the compiler attempts to move variables captured by closures onto the stack in Release builds. However, when a closure both captures and modifies an external local variable and uses [weak self], this optimization appears to misjudge the lifetime of the weak reference, prematurely releasing its storage before the closure executes and ultimately causing a crash. Since this optimization is not enabled in default Debug builds, the same code runs normally during development and debugging. Removing either [weak self] or the modification of the local variable avoids the issue.
This article offers two practical engineering reminders. First, don’t habitually use
[weak self]in non-escaping closures, as unnecessary code can sometimes introduce unexpected complexity. Second, never rely solely on Xcode’s default Debug builds for testing. Compiler optimizations can cause the same code to exhibit dramatically different runtime behavior, so be sure to thoroughly test Release builds before distributing your app.
Building a zero-wakeup macOS capture app and cutting Core ML OCR memory by 4×
For tools that reside in the menu bar and perform tasks on demand, idle resource consumption is just as important as performance during active use. In this article, Morax Cheng shares a series of performance optimizations implemented in OhMyShot, an open-source native macOS screenshot and screen recording tool. These include deferring camera and microphone authorization checks to avoid implicit AVFoundation initialization, using AppKit for persistent UI components, delegating update checks to the system’s background task scheduler, and using mmap to address the issue of large memory allocations being retained by libmalloc even after they have been freed. The app now achieves zero wakeups and a memory footprint of just 26 MB while idle after launch.
On the OCR side, the author discovered that Core ML continuously accumulates buffers used to transfer data between the Neural Engine and CPU when processing inputs of varying widths. By moving the final layer of the recognition model out of Core ML and performing the corresponding computations on the CPU using the Accelerate framework, Morax successfully reduced peak memory usage from approximately 1.5 GB to under 363 MB in both test cases, while improving recognition speed and largely preserving the original recognition accuracy. The article also explains how multiple recognition passes, pixel scanning, and geometric analysis can compensate for Apple Vision’s limitations when dealing with code indentation, standalone brackets, and editor line numbers.
What makes this article particularly impressive is that it was written by a Chinese high school student. At a time when many desktop applications readily consume hundreds of megabytes of memory in the background, he has not only committed to native development but also established clear performance budgets from the very beginning, continuously validating and refining his work through quantitative testing, and released the entire project under the GPL-3.0 license. A visit to his personal website reveals that, beyond the projects he develops and maintains himself, he has contributed nearly a hundred merged PRs to open-source projects such as Rust Clippy, Apache DataFusion, and Homebrew. To see someone so young demonstrate such engineering rigor, dedication to software quality, and sustained commitment to the open-source community is truly inspiring. The next generation is not to be underestimated.
Distinctive patterns for categorical data in Swift Charts
In data visualization, relying solely on color to distinguish categories is often insufficient for users with color vision deficiencies. In this article, Matthaus Woolard demonstrates how to use SwiftUI’s Image(size:renderer:) and ImagePaint to dynamically generate repeating fill patterns such as diagonal lines, dots, and checkerboards without additional image assets, and how to use chartForegroundStyleScale to automatically apply consistent fill styles to both bars and legends in Swift Charts. More cleverly, the author creates a custom ShapeStyle that responds to the accessibilityDifferentiateWithoutColor environment value in resolve(in:), allowing charts to automatically overlay patterns on their existing colors when users enable the Differentiate Without Color accessibility setting, without requiring any changes to the chart’s declarative code. This approach of encapsulating environment-responsive logic within styles is well worth adopting in other SwiftUI scenarios.
Building apps is a system design exercise
How can a voice message from a friend bypass your iPhone’s silent mode and play directly as a full-screen alarm? In this article, Jacob Bartlett uses his retro iPod-inspired app UltraPing to demonstrate a rather ingenious combination of APIs: a push notification triggers a Notification Service Extension, which downloads the sender’s audio recording in the background and saves it to a shared App Group directory, then invokes AlarmKit to schedule an immediately triggered alarm using the recording as its custom sound.
Building around this core mechanism, Jacob begins by validating the technical assumptions with the greatest uncertainty, then gradually introduces object storage, a database, stateless cloud functions, push notification services, and a user pairing mechanism based on mutual consent, ultimately constructing a complete end-to-end system. Throughout the process, each stage produces a working prototype, while the developer’s focus gradually shifts from implementing individual pieces of code to defining the responsibilities of system components and how they interact.
Had Jacob not written about it, this particular combination of APIs might have remained his personal secret for quite some time. I’m grateful for his generous sharing, but I can’t help admiring his ingenuity in seamlessly connecting the client, cloud services, storage, and underlying system mechanisms into a reliable whole.
Tools
swift-rrule: Parsing and Evaluating iCalendar Recurrence Rules in Swift
swift-rrule is an open-source Swift library by Mattt for parsing iCalendar recurrence rules (RRULE) defined by RFC 5545, calculating occurrence dates for recurring events, and generating localized natural-language descriptions (currently supporting English, German, Spanish, and French). It also provides bidirectional conversion with Foundation’s native Calendar.RecurrenceRule. The library features its own recurrence calculation engine and supports iOS 16 / macOS 13 and later.
In the accompanying article, Mattt introduces the expressive power of iCalendar recurrence rules by exploring the limitations of traditional cron expressions when describing schedules such as “the first Sunday of every month,” alongside the historical evolution of the rules governing the date of Thanksgiving in the United States. He also points out that Calendar.RecurrenceRule, introduced by Apple in iOS 18 / macOS 15, not only lacks string parsing and natural-language formatting capabilities but also produces results inconsistent with the RFC standard when evaluating recurrence rules such as “every Tuesday of each month” and “the last weekday of every month.” These shortcomings were precisely what motivated him to create swift-rrule.
Flocon: Giving AI Assistants a Window into Your App at Runtime
Inspired by Meta’s Flipper and maintained by Florent Champigny, Flocon is an open-source, cross-platform application debugging tool. It brings runtime network requests, logs, analytics events, and crash information together into a unified desktop timeline, exposing these debugging capabilities to AI assistants such as Codex, Claude Code, and Cursor through a built-in local MCP server. Beyond analyzing behavior that has already occurred, AI assistants can actively mock network responses, simulate poor network conditions, trigger deep links, and even capture screenshots, making it easier to identify and verify issues.
Swift developers can integrate the standalone FloconSwift SDK through Swift Package Manager and selectively enable features such as network monitoring (URLSession / gRPC / GraphQL), file browsing, UserDefaults and Keychain inspection, and even direct SQL queries against the SQLite databases underlying Core Data and GRDB. The SDK also leverages SwiftPM’s Package Trait mechanism, allowing developers to cleanly strip debugging functionality from production builds without modifying application code.
Kido: Running macOS Command-Line Tools on ARM64 Linux
Developed by Cocoa, the open-source project Kido brings Docker-like container workflows to Darwin. Developers can launch environments using kido run, package tools and dependencies into images using a Kidofile, and distribute them through standard OCI image registries. Unlike traditional containers, each Kido instance is a micro virtual machine (microVM) with its own independent XNU kernel. It uses Virtualization.framework on Apple silicon Macs and a built-in KVM VMM on ARM64 Linux. The base image is only around 30 MB, boots in approximately one second, and supports on-demand installation of runtimes and system libraries, including the Swift runtime, through its system package manager kl.
Even more interestingly, Kido provides an online playground that uses WebAssembly and WebGPU to run the Darwin kernel directly in the browser, with support for Metal 3 Compute operations. Although the project remains experimental and does not yet support full macOS applications or Apple’s native toolchain, this attempt to make Darwin environments lightweight and standardized opens up new possibilities for future cloud builds, automated testing, and isolated execution environments for coding agents.
In last week’s editorial, macOS for the Masses, or macOS for Developers?, I discussed using virtualization to alleviate the tension between macOS security mechanisms and the autonomous execution requirements of agents. Although Kido was not created to address this particular problem, the direction it explores is thought-provoking: perhaps developers don’t always need a complete macOS installation, but rather a lightweight, isolated Darwin execution environment that can be provisioned on demand. If such solutions mature, they could not only reduce the overhead of managing permissions for local agents but also offer more options for cloud-based development and automated verification within the Apple ecosystem.
SAGA: When AI Makes Cross-Language Porting a New Technical Option
SAGA (Swift Alternative GPU API) is a cross-platform GPU SDK written entirely in Swift, consisting of a standalone shader compiler and a GPU runtime with a WebGPU-style API. The project was initiated by Vladislav Prusakov, the creator of Ada Engine. According to the author’s account, with the help of AI agents, he completed an initial port of the core capabilities of the Rust-based Naga compiler and wgpu graphics framework in just three days, eliminating the complexity of introducing the Rust toolchain and cross-language bridging into Swift graphics projects. SAGA can already run on multiple platforms through backends such as Metal, Vulkan, Direct3D 12, and WebGPU, and supports translation between various shader languages. However, considerable work remains before it achieves full feature parity with the original projects.
More noteworthy than the capabilities SAGA currently offers is perhaps the experiment itself. In the past, when dealing with mature infrastructure written in another language, developers often had little choice but to accept existing dependencies or invest substantial resources in reimplementing them. Today, AI has dramatically reduced the cost of code porting and initial implementation, giving even independent developers the opportunity to rebuild foundational tools according to their own technical preferences. While long-term maintenance, compatibility, and correctness verification remain unavoidable challenges, SAGA demonstrates a new possibility: when implementation costs are no longer an insurmountable barrier, developers may gain greater freedom in their technical choices.
Thanks for reading Fatbobman’s Swift Weekly! This post is public so feel free to share it.
我的代码我做主
如今,不少借助 AI Agent 编写代码的开发者,已很少再逐行审查每一处实现,对项目的「掌控」更多依赖于几份规则文档。随着项目规模不断扩大,自己与代码之间的疏离感也会越来越强。当你想在某些环节亲自介入时,往往会发现竟有些无从下手。
作为一个即便不亲手编写代码,也希望代码能够保留个人风格的开发者,我一直在寻找一种途径,让项目中依然能够留存自己的痕迹。这不仅关乎存在感,也因为我相信,在不少场景中,现阶段的自己仍具备一些 AI 尚无法替代的能力。
好在,最近在开发自己的那个小 App 的过程中,我找到了一种让个人风格和技术想法更自然地融入项目的方式。从目前的结果来看,我还是颇为满意的。
作为一名博客作者,过去几年里我写了数百篇技术文章;作为一名周报编辑,我也依据自己的技术判断和偏好推荐了数百篇优秀的作品。在项目开发过程中,当 AI 的实现不符合我的预期时,我经常会将自己写过的文章、开发过的第三方库,或曾经深入阅读并推荐过的文章直接交给 AI,让它以其中的思路为参考来完成实现。相比干巴巴的规则约束,完整的文章或源码往往包含具体的上下文、设计动机、技术取舍与实现范例,AI 反而更容易准确领会我背后的意图。
结果就是,即便如今项目中的代码是多个不同模型共同参与的产物,我依然能够从中清晰地辨认出自己的风格和痕迹。这并不意味着我的想法一定比 AI 自主选择的实现方案更优秀,但这种熟悉感让我重新找回了对项目代码的实感。虽然代码不是我亲手写的,但其中的许多技术选择依然是我的。
为了让这种「掌控感」得以延续,持续输出更多能够体现个人风格、技术判断与设计思路的内容,或许将成为我未来努力的一个方向。
对于更多的开发者而言,既然 AI 已经大幅提高了代码实现的效率,我们是否可以将节省下来的时间用于拓宽技术视野、探索不同的实现思路,以及梳理和记录自己的经验与想法?这些积累不仅有助于提升我们自身的技术判断力,也能反过来指导 AI 做出更好的实现。
今后的技术写作,「人」或许不再是唯一的受众。除了让读者能够理解作者的想法,如何让 AI 也能准确理解并将这些想法付诸实践,将成为写作时不可忽视的考量。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 Buy Me a Coffee 支持我的创作。
近期推荐
ActorRPC:基于 HTTP 的 Swift 分布式 Actor 实验
Swift 的 Distributed Actors 虽然已经推出数年,但由于此前较为典型的应用场景多集中在数据中心内部的有状态分布式集群,对于绝大多数 Swift 开发者而言,这一语言特性仍显得有些遥远。近期,Simon Leeb 借助 Swift 主干分支中新加入的 Embedded Swift 对 Distributed 的支持,打造了一个端到端纯 Swift 的 RPC 概念验证项目 ActorRPC,展示了这一特性的另一种可能——为 Swift 带来类似 TypeScript 生态中 tRPC 的类型安全的全栈开发体验。
在作者提供的在线寻宝游戏中,前端使用 Embedded Swift 编译为 Wasm 并运行在浏览器中,通过普通的 JSON POST 请求调用部署在 AWS Lambda 上的 distributed actor。前后端以一个 @Resolvable 协议作为共享的 API 契约,无需额外的 Schema 定义或代码生成。整个方案不涉及集群管理机制,可以充分利用现有的 HTTP 基础设施,也能与 Vapor、Hummingbird 等服务端框架集成。
我认为这个项目背后最有意思的地方是:Distributed Actors 的价值不仅在于让 Actor 可以跨进程运行,也在于 Swift 编译器已经提供了一套语言级的、类型安全的远程调用机制。即便开发者并不需要传统意义上的分布式 Actor 系统,也可以单独利用这部分能力。
过度使用 weak 引发的 Swift 误编译崩溃排查 (A ‘Weak’ Too Far: Debugging a Swift Miscompilation)
不少开发者在重构 Swift 代码时,即便闭包已不再逃逸(non-escaping),也会习惯性地保留 [weak self],觉得多写一层弱引用总归无害。Matthias Gansrigler-Hrad 在本文中记录了一次令人头疼的崩溃排查经历:一段完全合法的代码,却因一个多余的 [weak self],在 Swift 6.4.2(Xcode 27.2)的 Release 编译优化下触发了编译器 Bug,导致应用在 guard let self 处崩溃,而在 Debug 模式下却完全无法复现。
借助 AI 对反汇编和 SIL 的分析,Matthias 最终将问题指向了 Swift 编译器的一项优化机制:为了减少堆内存分配,编译器在 Release 构建中会尝试将闭包捕获的变量转移到栈上。然而,当闭包同时捕获并修改外部局部变量,又使用 [weak self] 时,这项优化似乎错误地判断了弱引用的生命周期,在闭包执行前便提前释放了其存储空间,最终导致崩溃。由于默认的 Debug 构建不会启用这项优化,因此同样的代码在开发调试时运行正常。移除 [weak self] 或对局部变量的修改,均可避开这一问题。
这篇文章带来了两个颇为务实的工程提醒:一是不要习惯性地在非逃逸闭包中使用
[weak self],不必要的代码有时会引入意料之外的复杂性;二是切勿仅依赖 Xcode 默认的 Debug 构建进行测试,编译优化可能让同一份代码表现出截然不同的运行时行为,在分发应用前务必对 Release 构建进行充分测试。
打造零唤醒的 macOS 截图应用,将 Core ML OCR 峰值内存降至四分之一 (Building a zero-wakeup macOS capture app and cutting Core ML OCR memory by 4×)
对于常驻菜单栏、按需触发的工具而言,闲置时的资源开销与执行任务时的性能同样重要。Morax Cheng 在本文中分享了开源原生 macOS 截图录屏工具 OhMyShot 的一系列性能优化实践:延迟查询摄像头和麦克风的授权状态以避免 AVFoundation 的隐式初始化,使用 AppKit 构建常驻界面,将更新检查交由系统后台任务调度,以及利用 mmap 解决大块内存释放后仍被 libmalloc 缓存的问题。目前,应用启动后的闲置状态已实现 0 唤醒、26 MB 内存占用。
另外,在 OCR 方面,作者发现 Core ML 在处理不同宽度的输入时,会不断累积 Neural Engine 与 CPU 之间传递数据所需的缓冲区。通过将识别模型的最后一层移出 Core ML,改用 Accelerate 框架在 CPU 上完成相关计算,Morax 成功将两组测试中的峰值内存从约 1.5 GB 降至 363 MB 以内,同时提高了识别速度,并基本保持了原有的识别精度。此外,文章还介绍了如何通过多轮识别、像素扫描与几何信息分析,弥补 Apple Vision 在代码缩进、独立括号及编辑器行号等场景下的识别不足。
令人惊喜的是,这篇文章出自一位中国高中生开发者之手。在不少桌面应用动辄占用数百 MB 后台内存的今天,他不仅坚持原生开发,还从项目伊始便设定明确的性能预算,通过量化测试不断验证和优化,并将整个项目以 GPL-3.0 协议开源。浏览他的个人主页,你还会发现,在自己开发和维护的项目之外,他已为 Rust Clippy、Apache DataFusion、Homebrew 等开源项目贡献了近百个被合并的 PR。如此年轻便展现出这般严谨的工程态度、对软件质量的追求以及对开源社区的持续投入,着实令人感到后生可畏。
在 Swift Charts 中为分类数据添加可区分填充纹理 (Distinctive patterns for categorical data in Swift Charts)
在数据可视化中,单纯依赖颜色区分不同类别往往对色觉障碍用户不够友好。Matthaus Woolard 在本文中展示了如何利用 SwiftUI 的 Image(size:renderer:) 与 ImagePaint 动态生成斜线、圆点、棋盘格等重复填充纹理,无需额外的图片资源,并借助 chartForegroundStyleScale 让 Swift Charts 的柱状图与图例自动采用一致的填充样式。更巧妙的是,作者通过自定义 ShapeStyle,在 resolve(in:) 中响应 accessibilityDifferentiateWithoutColor 环境值,让图表在用户开启「不依赖颜色区分」无障碍选项时,自动在原有颜色的基础上叠加纹理,而图表自身的声明代码无须做任何调整。这种将环境响应逻辑封装在样式内部的设计思路,同样值得在其他 SwiftUI 场景中借鉴。
构建应用是一场系统设计练习 (Building apps is a system design exercise)
如何让朋友发来的一段语音突破 iPhone 的静音模式,以全屏闹钟的形式直接播放?Jacob Bartlett 在本文中以自己开发的复古 iPod 风格应用 UltraPing 为例,展示了一组颇具巧思的 API 组合:利用推送通知触发 Notification Service Extension,在后台下载对方录制的音频并存入 App Group 共享目录,随后调用 AlarmKit 调度一个立即触发、以该录音作为自定义铃声的闹钟。
围绕这一核心机制,Jacob 从验证最具不确定性的技术环节入手,逐步引入对象存储、数据库、无状态云函数、推送服务以及基于双方同意的用户配对机制,最终构建出一套完整的端到端系统。整个过程中,每个阶段都有一个可以实际运行的原型,而开发者需要关注的重点也从具体代码的实现逐渐转向系统各组成部分的职责与协作关系。
要不是 Jacob 写出来,这个组合玩法恐怕很长一段时间都会是他的独门秘籍。在感谢他无私分享的同时,也不得不佩服他的脑洞——把客户端、云端、存储和系统底层机制严丝合缝地串成一个可靠整体。
工具
swift-rrule:用 Swift 解析与计算 iCalendar 重复规则
swift-rrule 是 Mattt 开源的 Swift 库,用于解析 RFC 5545 标准的 iCalendar 重复规则(RRULE)、计算重复事件的发生日期,并生成本地化的自然语言描述(目前支持英、德、西、法四种语言),同时提供与 Foundation 原生 Calendar.RecurrenceRule 的双向转换能力。该库拥有独立的日期计算引擎,支持 iOS 16 / macOS 13 及以上版本。
在配套文章中,Mattt 从传统 cron 表达式难以描述「每月第一个星期日」的局限性以及美国感恩节日期规则的历史变迁切入,介绍了 iCalendar 重复规则的表达能力。他还指出,苹果自 iOS 18 / macOS 15 引入的 Calendar.RecurrenceRule 不仅缺少字符串解析与自然语言格式化能力,在计算「每月的所有星期二」「每月最后一个工作日」等重复规则时,也存在与 RFC 标准不符的问题。这正是他编写 swift-rrule 的初衷。
Flocon:让 AI 助手也能查看 App 的运行现场
受 Meta Flipper 启发,由 Florent Champigny 维护的 Flocon 是一套开源的跨平台应用调试工具。它将应用运行时的网络请求、日志、埋点及崩溃信息汇集到桌面端的统一时间线中,并通过内置的本地 MCP Server 将这些调试能力开放给 Codex、Claude Code、Cursor 等 AI 助手。除了分析应用已经发生的行为,AI 助手还可以主动模拟网络响应、制造弱网环境、触发 Deep Link 甚至截取界面,从而高效定位并验证问题。
对于 Swift 开发者,可以通过 Swift Package Manager 接入独立的 FloconSwift SDK,按需启用网络监控(URLSession / gRPC / GraphQL)、文件浏览、UserDefaults 与 Keychain 检查,甚至直接对 Core Data、GRDB 等底层的 SQLite 数据库执行 SQL 查询。此外,SDK 还利用了 SwiftPM 的 Package Trait 机制,让开发者无需修改业务代码,即可在正式发布的构建中干净地剥离调试功能。
Kido:在 ARM64 Linux 上运行 macOS 命令行工具
由 Cocoa 开发的开源项目 Kido 将类似 Docker 的容器式工作流带到了 Darwin。开发者可以通过 kido run 启动环境,使用 Kidofile 将工具与依赖打包成镜像,并通过标准的 OCI 镜像仓库进行分发。与传统容器不同,每个 Kido 实例都是一台拥有独立 XNU 内核的微型虚拟机(microVM)。在 Apple 芯片 Mac 上利用 Virtualization.framework,在 ARM64 Linux 上则使用内置的 KVM VMM。基础镜像仅约 30 MB,启动时间约一秒,还可通过系统包管理器 kl 按需安装 Swift Runtime 等运行时及系统库。
更有意思的是,Kido 甚至提供了一个在线体验环境,借助 WebAssembly 和 WebGPU,直接在浏览器中运行 Darwin 内核,并支持 Metal 3 Compute 运算。尽管项目仍处于实验阶段,尚不支持完整的 macOS 应用及苹果原生工具链,但这种将 Darwin 环境轻量化、标准化的尝试,为未来的云端构建、自动化测试以及 Coding Agent 的隔离执行环境提供了新的想象空间。
在上期周评 大众的macOS,还是开发者的macOS? 中,我谈到了通过虚拟化来缓解 macOS 安全机制与 Agent 自主执行需求之间的矛盾。Kido 虽然并非为解决这一问题而生,但它所探索的方向颇具启发性:开发者需要的或许并不总是一套完整的 macOS,而是一个轻量、可隔离、可按需创建的 Darwin 执行环境。如果这类方案能够逐渐成熟,不仅有望降低本地 Agent 的权限管理成本,也可能为苹果生态的云端开发与自动化验证带来更多选择。
SAGA:当 AI 让跨语言移植成为一种新的技术选择
SAGA(Swift Alternative GPU API)是一个完全使用 Swift 实现的跨平台 GPU SDK,由独立的着色器编译器和采用 WebGPU 风格 API 的 GPU 运行时组成。项目由 Ada Engine 的作者 Vladislav Prusakov 发起。据作者介绍,借助 AI Agent,他在短短三天内便完成了 Rust 生态中 Naga 编译器与 wgpu 图形框架核心能力的初步移植,从而免去了在 Swift 图形项目中引入 Rust 工具链与跨语言桥接的复杂度。目前,SAGA 已能通过 Metal、Vulkan、Direct3D 12 和 WebGPU 等后端在多个平台运行,并提供多种着色器语言之间的转换能力,但距离与原有项目实现完整的功能对等仍有不少工作要做。
相比 SAGA 当前提供了多少功能,这次尝试本身或许更值得关注。过去,面对成熟的跨语言基础设施,开发者往往只能选择接受现有依赖,或投入大量资源重新实现。如今,AI 大幅降低了代码移植与初始实现的成本,让独立开发者也有机会按照自己的技术偏好重新构建底层工具。尽管长期维护、兼容性与正确性验证依然是无法回避的挑战,但 SAGA 展示了一种新的可能:当实现成本不再是难以逾越的障碍,开发者或许能够获得更大的技术选择自由。

