Weekly Comment

Feedback and Communication
Recently, I received an email from Apple informing me that an issue I reported last April—@State’s abnormal initial value behavior in multi-window applications—has been fixed. What’s even more delightful is that this fix applies not only to the latest system but is also backward compatible with iOS 17.5, macOS 14.5, tvOS 17.5, watchOS 10.5, and visionOS 1.3. At the same time, the adaptation of certain new features in WWDC 2024 to older systems appears to signal that the SwiftUI team is breaking away from the traditional practice of confining new features and bug fixes solely to the newest systems.
Although the period from when I submitted the feedback last April until the fix was implemented at the beginning of this year was not short, I couldn’t hide my inner joy upon receiving the notification. This joy stems not only from the complete resolution of the issue but also from the recognition of my contribution as a developer to the ecosystem.
Even more coincidentally, a few days ago I received a private message from an engineer on the SwiftUI development team. He not only confirmed the other issue regarding the abnormal behavior of onChange that I reported but also candidly shared the consistency challenges that the SwiftUI API faces when adapting to Apple’s diverse system platforms. Compared to the polite yet somewhat formulaic reply from the Feedback Assistant, this direct, two-way communication resonates more deeply with ordinary developers.
In terms of maintaining developer relations, although Apple still has significant room for improvement, there are signs they are actively making changes. For instance, in the SwiftUI, Concurrency, and DB sections of the Apple Developer Forums, which I frequently browse, DTS engineers have notably improved in terms of response frequency, timeliness, and depth. I recommend that developers share the Feedback Assistant’s feedback ID when discussing issues on the forums, as this will undoubtedly help expedite the resolution process.
Quinn created a post to guide developers on how to provide clear and efficient feedback through the Feedback Assistant.
No matter how lively community discussions become, developers always look forward to receiving more accurate and in-depth technical insights from Apple engineers. I hope that Apple will continue to host multi-party interactive events like WWDC Digital Lounge or Ask Apple, elevating the relationship from one-way feedback to genuine two-way communication. Only then can we cultivate a healthier, more vibrant, and more attractive ecosystem community.
Previous Issue|Newsletter Archive
If you appreciate my work and want to promote your product to the Swift and iOS developer community, sponsoring my platform could be an excellent opportunity for you.
Your support through Patreon, or Buy Me a Coffee helps keep this newsletter and blog running. Thank you for finding this content helpful!
Recent Recommendations
Apple Vision Pro: 1 Year Later
In what seems like the blink of an eye, it has been one year since the release of Apple Vision Pro. In this article, Basic Apple Guy reflects on his experience over the past year and examines AVP’s performance in hardware, software, and user acceptance. The author believes that AVP offers an immersive, calm, and unhurried spatial computing experience—a quality that is both its strength and a factor that makes it challenging to become mainstream in our fast-paced society. Despite its excellent UI design, hardware craftsmanship, and media consumption experience, issues such as the lack of killer native apps, suboptimal wearing comfort, and short battery life make it difficult for AVP to integrate into everyday life. Nevertheless, the author hopes that by adjusting usage habits, AVP can deliver greater value, and he remains optimistic about its future development. At the end of the article, he also shares some accessory recommendations to enhance wearing comfort and overall user experience.
Grouping Controls with ControlGroup
In SwiftUI, the way components are presented can vary depending on the context. However, ControlGroup significantly improves interface clarity, discoverability, and consistency by grouping semantically related controls together, thereby optimizing the user experience. In this article, Antonella Giugliano provides a detailed introduction to the various uses of ControlGroup and demonstrates how to customize its appearance by conforming to the ControlGroupStyle
protocol—such as modifying background colors or adding borders—to create a more visually appealing and unified interaction. Additionally, ControlGroup plays an important role in accessibility by incorporating textual labels, making it easier for users who rely on assistive technologies to understand the function of the controls.
Sound Engineering on iOS: AudioToolbox, AVAudioSession, and UIFeedbackGenerator
Sound, music, and haptic feedback have always been vital components in enhancing the iOS user experience. In this article, Uwais Alqadri provides an in-depth look at iOS audio and haptic feedback technologies. Through code examples, he explains how to use AudioToolbox, AVAudioSession, and UIFeedbackGenerator to handle system sound effects, audio playback and recording, and haptic feedback. The article covers key topics such as system sound IDs, Taptic Engine haptic feedback, and audio session management, helping developers better optimize the audio interaction experience within their iOS applications.
Drawing Maps with Swift Charts
In this article, Artem Novichkov combines MapKit and Swift Charts to achieve a map visualization based on population data from various regions in Kazakhstan. The author uses MKGeoJSONDecoder
to parse GeoJSON data and extends MKPolygon
to extract coordinates and compute the centroid of regions. Subsequently, he employs Swift Charts’ AreaPlot
, LinePlot
, and PointMark
to render a population distribution map that vividly presents the differences across regions. By flexibly combining Apple’s official frameworks, Novichkov greatly enhances data processing and visualization efficiency, demonstrating Swift Charts’ potential in geographical data visualization.
Mastering TaskGroups in Swift
TaskGroups provide a means to manage dynamic subtasks, execute asynchronous tasks in batches, and flexibly control concurrency—making Swift’s concurrent programming more efficient. In this article, Majid Jabrayilov not only introduces the basic usage of TaskGroups but also highlights how improper use can lead to high memory consumption. To optimize task management, he proposes a strategy of adding tasks in batches: limiting the number of concurrent tasks and dynamically adding new ones only after the current tasks have been completed, thereby reducing memory usage and enhancing execution efficiency.
Parameterized Tests in Swift: Reducing Boilerplate Code
Parameterized tests in Swift Testing allow developers to run the same test function repeatedly with a set of input parameters, thereby avoiding the need to write separate test methods for each input and significantly reducing redundant code. Additionally, Xcode’s Test Navigator can clearly display the test results for each parameter, making debugging and issue identification more straightforward. In this article, Antoine van der Lee not only introduces the basic usage of parameterized tests but also discusses how to handle multiple parameter combinations. For instance, he explains how to set different free trial counts for different Feature
s and uses the zip
method to match each Feature
with its corresponding number of tries
, ensuring that the test logic remains clear and the code concise.
反馈与交流
近日,我收到苹果发来的一封邮件,告知我去年四月反馈的一个问题——@State 在多窗口应用中初始值的异常表现——现已修复。令人欣喜的是,此次修复不仅适用于最新系统,还向下兼容至 iOS 17.5、macOS 14.5、tvOS 17.5、watchOS 10.5 以及 visionOS 1.3。与此同时,WWDC 2024 部分新功能对旧版系统的适配,也似乎预示着 SwiftUI 团队正在打破“新功能与问题修复仅限最新系统”的传统做法。
虽然从去年四月提交反馈到今年年初修复,这个周期不短,但当我收到修复通知时,依然难掩内心的喜悦。这份愉悦不仅源自问题的彻底解决,更来自于作为开发者,为生态建设贡献力量而获得的认可感。
更为巧合的是,几天前我又收到了一位 SwiftUI 开发组工程师的私信。他不仅确认了我提交的 另一个关于 onChange 响应异常的问题,还直言不讳地分享了 SwiftUI API 在适配苹果众多系统平台时所面临的一致性挑战。相比于反馈助理那礼貌却略显公式化的回复,这种直接、双向的交流更能引起普通开发者的共鸣。
在开发者关系的维护上,尽管苹果仍有很大的提升空间,但某些迹象表明他们正在积极改变。以我经常浏览的 苹果官方开发者论坛 中的 SwiftUI、Concurrency 与 DB 三个版块为例,DTS 工程师在回复的频率、及时性和深度上均有显著改善。我建议开发者在论坛讨论后,将反馈助理中的反馈编号一并分享,这无疑有助于加快问题的解决进程。
Quinn 创建了一个 帖子,指导开发者如何通过反馈助理清晰、高效地反馈问题。
无论社区讨论多么热烈,开发者始终期盼能从苹果工程师处获得更准确、更深入的技术资讯。期待苹果能继续举办类似 WWDC Digital Lounge 或 Ask Apple 这样的多对多互动活动,将与开发者的关系从单向反馈提升至真正的双向交流。只有这样,才能营造出一个更健康、更活跃、更具吸引力的生态社区环境。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
近期推荐
Apple Vision Pro 一年使用体会 (Apple Vision Pro: 1 Year Later)
转眼间,Apple Vision Pro 已经发布一周年了。Basic Apple Guy 在本文中回顾了过去一年的使用体验,并探讨了 AVP 在硬件、软件和用户接受度方面的表现。作者认为,AVP 提供了一种 沉浸式、平静且不慌不忙的空间计算体验,这既是它的优势,也让其在快节奏社会中难以成为主流。尽管 AVP 具备出色的 UI 设计、硬件工艺和媒体观看体验,但缺乏杀手级原生应用、佩戴舒适度欠佳、电池续航短等问题,使其难以融入日常生活。尽管如此,作者仍希望通过调整使用习惯,让 AVP 发挥更大价值,并对其未来发展抱有期待。在文章的最后,他还分享了一些提升佩戴舒适度和使用体验的配件推荐。
SwifUI ControlGroup 详解 (Grouping Controls with ControlGroup)
在 SwiftUI 中,组件的呈现方式会随上下文不同而变化,而 ControlGroup 通过 将语义相关的控件组合在一起,大幅提升界面清晰度、可发现性和一致性,从而优化应用的用户体验。Antonella Giugliano 在本文中详细介绍了 ControlGroup 的多种用法,并演示了如何通过实现 ControlGroupStyle
协议来自定义外观,例如修改背景颜色、添加边框等,使界面更加美观且交互更统一。此外,ControlGroup 在无障碍体验方面也发挥着重要作用,通过添加文本标签,使依赖辅助技术的用户更容易理解控件的功能。
🪜 iOS 的声音引擎 (Sound Engineering on iOS: AudioToolbox, AVAudioSession, and UIFeedbackGenerator)
声音、音乐和触觉反馈一直是提升 iOS 用户体验的重要组成部分。在本文中,Uwais Alqadri 详细介绍了iOS 音频与触觉反馈技术,并通过代码示例讲解如何使用 AudioToolbox、AVAudioSession 和 UIFeedbackGenerator 处理系统音效、音频播放与录制、触觉反馈等功能。文章涵盖系统声音 ID、Taptic Engine 触觉反馈、音频会话管理等关键内容,帮助开发者更好地优化 iOS 应用的音频交互体验。
用 Swift Charts 绘制地图 (Drawing Maps with Swift Charts)
在本文中,Artem Novichkov 结合 MapKit 和 Swift Charts,实现了基于哈萨克斯坦各地区人口数据的地图可视化。作者使用 MKGeoJSONDecoder
解析 GeoJSON 数据,并通过扩展 MKPolygon
提取坐标和计算区域中心点。随后,利用 Swift Charts 的 AreaPlot
、LinePlot
和 PointMark
绘制人口分布地图,直观呈现不同地区的人口差异。Novichkov 通过灵活组合 Apple 官方框架,大幅提升数据处理与可视化效率,展示了 Swift Charts 在地理数据可视化方面的潜力。
掌握 TaskGroups (Mastering TaskGroups in Swift)
任务组(TaskGroups)是一种管理动态子任务、批量执行异步任务并灵活控制并发的方式,使 Swift 并发编程更高效。Majid Jabrayilov 在本文中不仅介绍了 TaskGroups 的基本用法,还重点探讨了不合理使用 TaskGroups 可能导致的高内存消耗。为了优化任务管理,他提出了一种 分批添加任务 的策略:限制并发任务数量,在已有任务完成后再动态添加新任务,从而减少内存占用并提升执行效率。
参数化测试 (Parameterized Tests in Swift: Reducing Boilerplate Code)
Swift Testing 的参数化测试(Parameterized Tests)允许开发者 使用一组输入参数重复运行同一个测试函数,避免为每个输入单独编写测试方法,从而大幅减少冗余代码。同时,Xcode 的 Test Navigator 还能直观地展示每个参数的测试结果,方便调试和快速定位问题。Antoine van der Lee 在本文中不仅介绍了参数化测试的基本用法,还探讨了如何处理多参数组合,例如:为不同 Feature
设定不同的免费试用次数,并使用 zip
方法将 Feature
与对应的 tries
数量匹配,以确保测试逻辑更清晰、代码更精炼。
Let's Vision 2025 抽奖
LET’S VISION 是中国最大、最具国际化的 Apple 生态盛会,被誉为 Apple 生态中的“超级盛典”。本届大会将在 2025 年 3 月 1 日 —— 3 月 2 日 在 上海鲜花港 举办,主题为:人工智能 + 空间计算 = 无限♾️ 。活动将带领你走在 Apple 生态的最前沿,展示最创新、最尖端的产品与技术。无论你是开发者、创业者,还是行业精英,这将是你不可错过的年度盛会!
请访问 Let's Vision 大会官网 了解更多活动详情和嘉宾名单。学生可以享受半价购票优惠。
我作为嘉宾将分享与 SwiftUI 布局原理有关的内容。
在 2 月 18 日,我会从下方参与者中抽取一人送出一张大会门票(Basic Pass ¥699 )。参与方法为:
在 weekly.fatbobman.com 订阅周报
并在下方留言回复:Let's Vision 2025
期待与你在上海相见。
我还会在 X 上抽取一张,可在 此处 参与。
Wow! Great that Apple Developer have contacted you personally. Would be awesome if that would be a usual practice rather than exception.
Let's Vision 2025