Fatbobman's Swift Weekly #076
Photographing My Fur BabiesI have a 13-year-old dog and a cat who's just over six. Over the years, I've taken my dog to a pet photography studio almost annually, but my cat's severe social anxiety has kept him from joining these photo sessions. In the past year, though, we've noticed some improvement in our cat's demeanor. While he still resists going outside, he now recovers in just minutes after returning from baths or vet visits, rather than the hours it used to take. Seeing this progress, my wife and I decided to take a chance this year by bringing both furry brothers to the studio, hoping to capture a wonderful photo of them together. For this photoshoot (last weekend), we prepared extensively. Beyond booking a more relaxed and generous time slot, we packed an "emergency kit" of their favorite treats, toys, and familiar blankets, particularly concerned that the studio environment might stress our cat. To our delight, despite our cat's face clearly saying "I'm not happy about this" throughout the entire session, the photoshoot went relatively smoothly—though the coveted dog-and-cat portrait didn't quite meet our expectations. But the real test was just beginning. After the photoshoot, my wife and I kept a watchful eye on our cat's every move. He seemed fine on the surface, but we couldn't shake a feeling of unease. Sure enough, the morning after the photoshoot, he had diarrhea, which sent our anxiety through the roof. Fortunately, after two bouts, everything appeared to return to normal—his energy was good, and his appetite remained strong. However, later that day, my wife reported that our cat's urination didn't seem as smooth as usual and instructed me to monitor him closely. Cat owners know that urinary issues can be quite serious for felines and are often triggered by stress. This morning (before sitting down to write this newsletter), our cat seemed to sense our worries. He approached me with a soft meow, guiding me to follow him to his private bathroom. Under my watchful eye, he leisurely drank water for a few minutes, then smoothly completed his urination before darting off to play—demonstrating his healthy physical condition through actions rather than words—leaving me both relieved and amused. Though cats and dogs don't speak human language, they're certainly not lacking in intelligence. They can keenly sense your concern and respond in their own ways. While caring for them certainly requires effort, the pure emotional connection they provide far exceeds what we invest. I'm incredibly grateful for these little beings who bring such warmth to human society. I've just scheduled another photoshoot with the studio for six months from now. I'm hoping to finally realize my small wish—to recreate the scene from my cartoon avatar: a perfect portrait with my fur babies sitting quietly on either side of me. In this age where large language models increasingly blur the line between human and AI communication, making interactions with AI feel almost indistinguishable from those with real people, I still cherish the wordless yet deeply connected communication I share with my pets. That subtle, authentic beauty is a living connection that even the most advanced technology can never replace. 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. OriginalUsing Proxyman to Intercept and Simulate iPhone App Network RequestsIn the Internet age, developers increasingly interact with network data. Just as we rely on the debugging features of our IDEs to optimize our code, network debugging tools have become indispensable assistants for quickly, efficiently learning, researching, and analyzing network data. This article explains how to use Proxyman to capture the network request information of an iPhone app and simulate server responses by providing mock data. This allows you to test and develop applications without relying on a real server. Recent RecommendationsWhy I Avoid Group
Implementing Sign in with Apple in the watchOS SimulatorSince Sign in with Apple isn’t supported in the watchOS Simulator, it can be a major hurdle during development. In this post, Leo Dion describes a clever workaround used by the BrightDigit team: the server writes temporary authentication data to the Simulator, while the client watches for file changes and triggers the login flow. This approach simulates a realistic login experience during development and integrates cleanly into existing authentication architectures—making it especially useful for those testing login functionality on watchOS. Color Space in Color-Specific APIsColor management has long been one of Apple's strongest areas, but mishandling color spaces can easily lead to display mismatches or inconsistencies across platforms. In this article, Weichao Deng dives deep into how common Apple APIs like Building a MCP server in SwiftThe Model Context Protocol (MCP) is one of the most exciting emerging concepts, extending LLM capabilities to interact with real-world data and tools. For Apple platform developers, building an MCP server in Swift is an excellent way to get started. In this post, Adam Wulf shares his experience using the mcp-swift-sdk to implement a basic MCP server. He explains the architecture, stdio-based transport, tool registration and invocation, and how to integrate with Cursor and Claude for testing and development.
Solving Swift Macro Trust Issues in Xcode Cloud BuildsSwift macros offer powerful capabilities, but they often cause build failures in Xcode Cloud due to trust errors like “Target must be enabled.” In this article, Cihat Gündüz presents a simple and effective fix: add a Git Hooks 🤝 SwiftGit hooks are a great way to automate code checks and validations at commit time, yet many Apple developers avoid them due to unfamiliarity with bash. In this article, Natan Rolnik demonstrates how to gradually adopt Swift for Git hooks—starting with shell scripts, then moving to Swift scripts and finally compiled executables. He shares practical examples like enforcing commit message prefixes ( 给毛孩子照相我有一只 13 岁的狗狗和一只六岁多的猫咪。这些年来,我几乎每年都会带狗狗去宠物照相馆拍照,但由于猫咪过于社恐,一直不敢带他出门拍照。近一年来,我们发现猫咪的状态似乎有了些许改善。虽然他仍然抗拒出门,但在洗澡或去医院回家后,不再需要几个小时才能平复情绪,现在只消几分钟就能恢复正常。看到这样的进展,我和太太决定今年冒险一试,带这兄弟俩一起去拍照,最好还能拍下一张精彩的合影。 为了这次拍摄行动(上个周末),我们做了充分的准备工作。除了预约了更宽松、更充裕的拍摄时段外,还为毛孩子们准备了一系列“应急物资”——它们钟爱的零食、玩具、习惯的毯子等,尤其担心拍照环境会让猫咪产生应激反应。令人欣喜的是,尽管猫咪全程写满了“我不情愿”四个大字,但拍摄工作还是相对顺利地完成了,只是期待中的猫狗合照不太如人意。 然而,真正的考验此时才刚刚开始。拍照结束后,我和太太开始时刻关注猫咪的一举一动。表面上他看起来很正常,但我们心里总有一丝不安。果不其然,拍照后的第二天早晨,他腹泻了,这一状况让我们的心一下提到了嗓子眼。所幸在腹泻两次后,一切似乎又回归正常——精神状态良好,食欲也不减。然而过了半天,太太又向我报告,猫咪的排尿似乎没有往日那么顺畅,叮嘱我要密切观察。养过猫的朋友都知道,排尿不畅对猫咪而言是相当严重的问题,很可能是应激反应导致的。 今早(在我落笔写这篇周报前),猫咪仿佛读懂了我们的忧虑,主动来到我身边轻声唤我,示意我跟随他去往他的专属卫生间。在我的注视下,他先是悠然自得地喝了几分钟水,接着顺畅地完成了排尿大业,随后便一溜烟地跑去玩耍,用实际行动展示了他健康的身体状态,留下我一人哭笑不得。 猫狗虽然不会说人类的语言,但它们的智商并不低。它们能敏锐地感受到你的关切,并以自己的方式给予回应。照顾它们确实需要投入不少心力,但从它们身上获得的那份纯粹的情感回馈,远远超出了我们的付出。我无比庆幸有这些小生灵给人类社会带来更多的温情。 刚才,我已经与宠物照相馆约定了六个月后的再次拍摄。期待下次能够实现我的小愿望——拍出和我卡通头像一样的理想中的合照:两个毛孩子安静地分坐在我的左右。 在这个大模型不断模糊人类与 AI 之间交流界限的时代,AI 让我们产生与真人对话无异的互动体验。然而,我更珍视与猫狗之间那种无需言语却心灵相通的交流方式——那种朦胧而真实的美感,是科技再发达也无法取代的生命连结。 如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。 原创使用 Proxyman 拦截和模拟 iPhone 应用的网络请求在互联网时代,开发者日益频繁地与网络数据打交道。正如我们依赖 IDE 的调试功能来优化代码一样,网络调试工具已成为我们快速、高效地学习、研究和分析网络数据不可或缺的助手。本文将介绍如何利用 Proxyman 来捕获 iPhone 应用的网络请求信息,并通过提供 Mock 数据来模拟服务器响应,帮助开发者在不依赖真实服务器的情况下进行应用测试与开发。 近期推荐为什么我避免使用 Group (Why I Avoid Group)
在 watchOS 模拟器中实现 Sign in with Apple (Implementing Sign in with Apple in the watchOS Simulator)由于 watchOS 模拟器不支持 Sign in with Apple,给开发带来不少不便。Leo Dion 在文中介绍了 BrightDigit 团队在开发 Apple Watch 健身应用时采取的一种变通方案:由服务器向模拟器写入临时文件以传递认证信息,并通过客户端监听文件变化触发登录流程。这种方法不仅能在开发过程中模拟真实的登录体验,还可灵活融入现有的认证架构,对于在模拟器中调试 watchOS 登录逻辑的开发者非常实用。 🪜 苹果 API 中的色彩空间 (Color Space in Color-Specific APIs)苹果生态的色彩管理机制一直是其最重要的护城河之一,但若对色彩空间处理不当,开发者很容易遇到色彩显示偏差或平台间不一致的问题。Weichao Deng 在本文中深入剖析了 Apple 各平台中常用的颜色相关 API(如 用 Swift 构建 MCP 服务 (Building a MCP server in Swift)MCP(Model Context Protocol)是当前最火热的概念之一,它扩展了大模型的能力,让 AI 能够与现实数据和操作场景深度整合。作为 Apple 平台开发者,最适合的切入方式就是使用熟悉的工具构建自己的 MCP 服务。在本文中,Adam Wulf 分享了他使用 Swift 库 mcp-swift-sdk 构建 MCP 服务端的实践经验,介绍了 MCP 的基本架构、通信机制(基于
解决 Xcode Cloud 构建时 Swift 宏的信任问题 (Solving Swift Macro Trust Issues in Xcode Cloud Builds)Swift 宏为开发带来了巨大的灵活性,但在 Xcode Cloud 上构建时却常因“Target must be enabled”错误而中断流程。在本文中,Cihat Gündüz 提供了一种简单且有效的解决方案:通过在项目中添加 用 Swift 编写 Git Hooks (Git Hooks 🤝 Swift)Git Hooks 是一种在代码提交关键节点自动执行规范检查、验证等操作的机制,但在 Apple 生态中,由于多数开发者不习惯使用 bash,往往被忽视。Natan Rolnik 在本文中从简单的 Bash 脚本出发,逐步演示了如何将 Swift 引入 Git Hooks 的开发流程,包括使用 Swift 脚本,乃至构建可执行文件。文中展示了如何检查 commit message 是否包含特定前缀(如 求贤:【北京/上海/杭州/深圳】抖音——基础技术同学,你喜欢 Swift 吗?我们诚邀身处 北京、深圳、上海、杭州 的你,和我们一起踏上这趟注定不平凡的旅途:
如果你想让你对 Swift 的热情化为实际的一行行代码,请将简历发往:renyujie.spatial@bytedance.com Welcome to my blog Fatbobman's Swift Blog( 肘子的Swift记事本 ) |