I Almost Lost Patton (My Dog)
Patton is 13 years old now. While he usually displays far more energy and vitality than other dogs his age, various health issues have inevitably emerged as he's gotten older. Recently, Patton was diagnosed with pulmonary hypertension, and the vet prescribed a targeted treatment plan. Just as I was feeling relieved that the treatment seemed to be working, last Monday afternoon, Patton suddenly couldn't stand, was drooling excessively, and showed clear signs of cardiac distress.
It was rush hour, and to avoid losing precious treatment time traveling to the specialty hospital, I first took him to the nearest veterinary clinic for emergency care. When we transferred to the cardiac specialty hospital two hours later, Patton was already disoriented and in critical condition. Tuesday night was especially dire—all his vital signs indicated he was about to leave us. Miraculously, through his incredible will to live and the constant calling from my wife and me, he pulled through.
During the six days I spent with him at the veterinary hospital, I constantly recalled every moment of the past thirteen years he'd been with our family, feeling grateful for the wonderful times we've shared. Watching him go from bouncing around just the day before to being weak and helpless broke my heart.
The doctors and nurses all praised him as a fighter with extraordinary vitality. On the fourth day of hospitalization, as his consciousness gradually returned, Patton began showing his longing for home, repeatedly letting my wife and me know he wanted to go back. With the doctor's permission, even though many of his indicators were still far from ideal, I brought him home yesterday. Perhaps the familiar environment gave him extra strength—in just one day at home, many previously stubborn health indicators have been rapidly improving.
Though this episode means my wife and I need to devote much more energy to his daily care, as long as we can be together with him longer, everything is worth it.
Patton, you're going to get better! Mommy and I love you so very much!
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.
Recent Recommendations
TextKit 2 - The Promised Land
TextKit is Apple’s text layout and rendering framework, providing high-level APIs for developers to handle complex text layouts and interactions. Its goal is to make it easier for iOS and macOS apps to implement text rendering, rich text editing, and high-performance text interactions.
When TextKit 2 was released four years ago, it was hailed as “simpler, faster, and better.” However, in practice it has fallen short of those promises. As the author of STTextView and Notepad.exe, Marcin Krzyżanowski reflects on years of experience and concludes that while TextKit 2’s architecture is elegant, its implementation is lacking—particularly for text editing use cases. He argues that TextKit 2 may not be the ideal tool for building modern text UIs.
In addition, Michael Tsai has compiled related discussions on his blog, which readers may find helpful to join.
Why LLMs Can’t Really Build Software
After trying various large language model products, I’ve consistently felt that LLMs lack a true global perspective in software development—even with the largest context windows. I struggled to articulate why until Conrad Irwin laid it out clearly: effective software engineering depends on an iterative loop, with the engineer’s key skill being the ability to maintain clear mental models.
LLMs can write code, make edits, run tests, and even debug, but they cannot maintain consistent context—making it hard for them to converge on correct solutions. Conrad believes the future of software development will be “humans + agents” working together, but for now, the driver’s seat firmly belongs to humans.
Working with the Main Menu in SwiftUI
Compared to iOS/iPadOS, there are far fewer macOS app developers, which means that even though SwiftUI has long supported window menus, few are truly familiar with it. With iPadOS 26 introducing a macOS-like windowing experience, developers now need to master the relevant APIs to adapt their apps. In this post, Gabriel Theodoropoulos provides a detailed guide to SwiftUI’s main menu APIs.
Hidden Gems in the Swift Argument Parser - Part I
Apple’s open-source library swift-argument-parser greatly simplifies argument parsing when building command-line tools in Swift, but it also includes some lesser-known features. For example, all CLI tools built with Argument Parser come with a built-in --generate-completion-script command to automatically generate completion scripts for Bash, Zsh, and Fish. In this article, Natan Rolnik explains how to use this feature and previews more advanced techniques that will be covered in the next installment.
How to Generate Dynamic Data Structures With Apple Foundation Models
There’s plenty of material on defining static data structures with GenerationSchema, but far less on using DynamicGenerationSchema to support dynamic data structures with Apple Foundation Models. Even the examples shown at WWDC 2026 were overly simplified and didn’t demonstrate the full workflow. Justin Searls uses a cocktail recipe generator as an example to show how to construct a dynamic schema at runtime and parse the results. He also notes that while the API was updated in OS 26 beta 5, the documentation was not—creating potential pitfalls for developers.
NavigationStack + Deep Linking in Large SwiftUI Apps
Although SwiftUI’s navigation APIs have matured, building an elegant, type-safe, and maintainable routing system in large apps remains a challenge. Wesley Matlock shares a complete architecture: modeling all navigation routes as Hashable + Codable enums, managing navigation state from a single data source, and seamlessly supporting deep linking, state restoration, and debugging tools. A standout feature is the “route chain” design—deep links aren’t just simple jumps but construct the full navigation path, ensuring users always have a clear way back.
Tools
SwiftAgent - An Elegant AI Agent Framework
Even if your app doesn’t yet use Apple’s Foundation Models, it’s hard not to admire the framework’s elegant API design, which showcases the best of Swift. Inspired by this, Dennis Müller created SwiftAgent, an open-source project that brings FoundationModels’ declarative API style to cross-platform AI agent development.
SwiftAgent uses the @Generable macro for type-safe tool definitions, offers zero-configuration agent loops, and supports multiple AI backends (currently including OpenAI). Most impressive is its approach to context management—cleanly separating user input from augmented information and using the ResolvedToolRun enum to provide compile-time type-safe tracking of tool calls. For developers looking to integrate AI agents into Swift apps, SwiftAgent offers a familiar and elegant path forward.
我差点失去了巴顿(我的狗狗)
巴顿已经 13 岁了。尽管大多数时候他都表现出远超同龄狗狗的活力和状态,但随着年龄增长,各种健康问题也随之而来。不久前,巴顿被检查出肺动脉高压,医生给出了针对性的治疗方案。就在我为治疗似乎初见成效而欣慰时,上周一下午,巴顿突然无法站立,大量流口水,表现出明显的心脏不适。
当时正值下班高峰,为避免去专科医院途中耽误最佳治疗时机,我先带他到最近的宠物医院急救。两小时后转入心脏病专科医院时,巴顿已经意识模糊,状况十分危急。尤其是周二晚上,他的各项生命体征都在表明他即将离我们而去。万幸的是,凭借顽强的求生欲以及我和太太的呼唤,他最终挺了过来。
在宠物医院陪伴他的六天里,我时刻回想着过去十三年他陪伴我们全家的点滴,庆幸生命中能拥有和他一起生活的美好时光。看着他从前一天的活蹦乱跳到如今的虚弱无助,心中难过至极。
作为被医生和护士称赞具有超强生命力的宝宝,住院第四天,当意识逐渐恢复后,巴顿便表现出对家的渴望,不断向我和太太表示想要回家。在医生同意后,尽管很多指标仍不理想,昨天我还是将他接回了家。或许是熟悉的环境给了他更多力量,回家后的一天里,许多之前难以改善的健康指标都在快速好转。
虽然经历这次发病后,我和太太需要投入更多精力照顾他的生活起居,但只要能和他多在一起,一切都是值得的。
巴顿,你会好起来的!我和妈妈真的很爱你!
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
近期推荐
TextKit 2:未兑现的承诺 (TextKit 2 - The Promised Land)
TextKit 是苹果提供的文本排版与渲染框架,为开发者提供高层次 API,用于处理复杂的文字布局与交互。它的目标是让 iOS 与 macOS 应用能够更轻松地实现:文本渲染、富文本编辑与高性能的文本交互。
在四年前发布时,TextKit 2 被寄予厚望,号称“更简单、更高效、更优越”。然而在实际使用中却并未完全兑现承诺。作为 STTextView 与 Notepad.exe 的作者,Marcin Krzyżanowski 基于多年的实践,指出 TextKit 2 虽然架构优雅,但实现质量欠佳,尤其在文本编辑场景下问题突出。他认为,TextKit 2 也许并非构建现代文本 UI 的理想选择。
此外,Michael Tsai 也在他的博客中整理了相关讨论,感兴趣的读者可以进一步参与。
LLM 为何无法真正构建软件 (Why LLMs Can't Really Build Software)
在尝试过多个大模型产品后,我始终觉得 LLM 在软件开发中缺乏全局观——即使产品提供了再大的上下文窗口。而为什么会这样,我一直难以准确表述。Conrad Irwin 在本文中给出了清晰的解释:有效的软件工程依赖于一个持续迭代的循环,其核心是工程师能维护清晰的心理模型。
LLM 虽然能写代码、修改代码、运行测试,甚至参与调试,但它们无法维持稳定的上下文,因此难以收敛到正确的解。Conrad 认为,未来软件开发的形态将是“人类 + 智能体”的协作,但至少在当下,驾驶位依然牢牢掌握在人类手中。
SwiftUI 主菜单开发指南 (Working with the Main Menu in SwiftUI)
相较于 iOS/iPadOS,macOS 应用的开发者数量要少得多,因此尽管 SwiftUI 很早就支持了窗口菜单,仍然鲜有人熟练使用。随着 iPadOS 26 引入类似 macOS 的窗口化体验,开发者必须尽快掌握相关 API 以适配新系统。在本文中,Gabriel Theodoropoulos 对 SwiftUI 主菜单 API 进行了详细讲解。
Swift Argument Parser 隐藏技巧 (Hidden Gems in the Swift Argument Parser - Part I)
苹果的开源库 swift-argument-parser 大幅降低了 Swift 开发者在构建命令行工具时的参数解析难度,而且其中还隐藏着一些鲜为人知的功能。比如,所有基于 Argument Parser 的 CLI 工具都内置了 --generate-completion-script
命令,可为 Bash、Zsh、Fish 自动生成补全脚本。在本文中,Natan Rolnik 详细介绍了该功能的使用方法,并预告将在下一篇继续探索 Swift Argument Parser 更多的进阶特性。
Foundation Models 动态数据结构生成 (How to Generate Dynamic Data Structures With Apple Foundation Models)
关于如何使用 GenerationSchema 定义静态数据结构的资料已经不少,但利用 DynamicGenerationSchema
在 Apple Foundation Models 中支持动态数据结构的内容却相对稀缺。即便在 WWDC 2026 中,相关示例代码也过于简化,未能完整展现整个流程。Justin Searls 以鸡尾酒配方生成器为例,详细演示了如何在运行时构建动态 schema 并解析结果。此外,他还指出 OS 26 beta 5 的 API 已更新,但文档未及时同步,极易让开发者踩坑。
大型 SwiftUI 应用的导航与深度链接 (NavigationStack + Deep Linking in Large SwiftUI Apps)
尽管 SwiftUI 的导航 API 日趋成熟,但在大型应用中构建一个优雅、类型安全且易于维护的路由系统仍充满挑战。Wesley Matlock 分享了一套完整的架构方案:将所有导航路由建模为 Hashable + Codable
的枚举,通过单一数据源管理导航状态,实现了深度链接、状态恢复和调试工具的无缝集成。特别值得称道的是其"路由链"设计——深度链接不只是简单跳转,而是构建完整的导航路径,确保用户始终拥有清晰的返回路径。
工具
SwiftAgent - 优雅的 AI 代理框架
即便你的应用暂时用不到 Apple 的 Foundation Models,也不得不承认该框架的 API 设计优雅,充分展现了 Swift 语言的特色。Dennis Müller 开发的 SwiftAgent 正是深受这一设计理念启发的开源项目,它将 FoundationModels 的声明式 API 风格带到了跨平台 AI 代理开发中。
该项目通过 @Generable
宏实现类型安全的工具定义,提供零配置的代理循环,并支持多种 AI 适配器(目前已支持 OpenAI)。最令人印象深刻的是其对上下文管理的处理——清晰地分离用户输入与增强信息,以及通过 ResolvedToolRun
枚举实现编译时类型安全的工具调用追踪。对于想要在 Swift 应用中集成 AI 代理功能的开发者来说,SwiftAgent 提供了一条熟悉且优雅的实现路径。
Wishing Patton a happy life with such supportive and caring family!