Weekly Comment
WWDC 2024, AI is Not Everything
Apple has always been a pragmatic participant in the AI field, providing excellent on-device AI capabilities. However, since the rise of generative AI last year, investors, consumers, and developers alike have been eager for Apple to offer more intuitive and perceptively rich AI technologies. Given the current market demands, it is foreseeable that AI-related content will occupy a very important position at this year's WWDC 2024.
Nevertheless, even putting AI aside, I predict that WWDC 2024 will still be the most topic-rich and significant update in recent years, based primarily on two reasons:
Firstly, it is very likely that Swift 6 will be announced at this WWDC. Since the launch of Swift 5 in 2019, the Swift community has spent five years preparing for this major version update, the longest interval in the history of Swift development. Developers will need to adapt to new language features and some disruptive updates, which will be thoroughly discussed at WWDC 2024.
Secondly, as the first hardware product in the Apple ecosystem that requires the use of SwiftUI for native application development, the early launch of Apple Vision Pro will greatly boost the development of SwiftUI. It is expected that at this conference, SwiftUI and SwiftData will receive significant functional enhancements, and Apple may also give a clear signal that SwiftUI is to be positioned as the primary UI framework. For developers who have not yet learned or used SwiftUI, this means investing more effort to master these new tools.
Given that this year's WWDC is full of highlights, I recommend that everyone adjust their state and fully engage in the grand event a week later. AI is certainly one of the highlights, but it is by no means all there is to WWDC 2024!
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!
Originals
Before WWDC 2024: The Future Potential and Real Challenges of SwiftData
At the WWDC 2023, Apple launched the highly anticipated new generation data management framework — SwiftData. As the successor to Core Data, can SwiftData play a key role in the Apple ecosystem? With WWDC 2024 approaching, this article will evaluate the overall performance of SwiftData since its initial release during the Xcode 15 period (i.e., its first major version), and provide a forecast of its future development.
At the end of this article, I list some key features missing from the first version of SwiftData, the main issues present, and several temporary solutions.
Recent Selections
Untangling the AttributeGraph
AttributeGraph is a private framework based on C++ that plays a crucial role behind SwiftUI, mainly responsible for tracking data dependencies to determine when views are updated. Although it plays a vital role in the architecture of SwiftUI, related literature is quite scarce. In this article, Rens Breur will demonstrate how to read and understand the functions of AttributeGraph through stack tracing, as well as how to use the LLDB command line tool to invoke and view various print functions of AttributeGraph. Moreover, the article also explores how to utilize the features of AttributeGraph to optimize and understand the update mechanisms of environment variables and preferences (PreferenceKey) in SwiftUI, providing some practical debugging tips and functions to help developers more deeply understand and use AttributeGraph.
Tricking iOS Into Animating App Icons
In the iOS system, through the Alternate App Icons system, users can select application icons from a set of predefined static images. In this article, Bryce Bostwick discusses how to create animated effects by frequently changing icons. The article details how to implement this using private APIs and explains the relevant technical details. Although using private APIs may prevent the application from passing the App Store's review, developers can still understand the internal workings of the iOS system's icon handling mechanism through this method, providing inspiration for other compliant innovative applications.
@preconcurrency Usage in Swift Explained
With the upcoming release of Swift 6, more and more developers are enabling strict concurrency checks in their projects. In this process, developers often find that even when using official frameworks, the compiler issues warnings related to concurrency. To suppress these warnings, developers usually add @preconcurrency
before importing modules. However, the application of @preconcurrency
goes beyond just this. In this article, Donny Wals will detail the various uses of @preconcurrency
. @preconcurrency
not only helps integrate old modules into new code but also allows new code to be used in old projects, thus fully preparing for the release of Swift 6.
Scenes Types in a SwiftUI Mac App
When building macOS applications using SwiftUI, understanding and utilizing various scene types is key to creating multifunctional and efficient apps. Each window in SwiftUI corresponds to a scene, which not only includes the common application windows (WindowGroup) but also encompasses DocumentGroup, Settings, Window, and MenuBarExtra located in the system menu bar. In this article, Natalia Panferova delves into the purposes and implementation methods of these scene types, helping developers fully leverage the powerful capabilities of SwiftUI to construct richer and more efficient macOS applications.
Building Weather Applications with WeatherKit
WeatherKit is a powerful weather information framework developed by Apple, offering a substantial number of free calls, greatly reducing the barrier for developers to build weather applications or add weather information to existing projects. In this series of tutorials, Stewart Lynch will guide you through the process of building a complete weather application step-by-step, combining SwiftUI and WeatherKit. This series includes seven videos, covering not only the basics but also some advanced techniques, aimed at helping developers fully harness the potential of these two powerful tools.
Pathways
For many developers new to the Apple development ecosystem, the abundance of scattered resources provided by Apple can often feel overwhelming. To address this issue, Apple has specifically set up the Pathways page. This site provides clear learning paths for various domains, including design, Swift, SwiftUI, gaming, visionOS, and App Store distribution, incorporating relevant documents, videos, and other resources. Whether for beginners or experienced developers, everyone can find suitable guides here to systematically learn and enhance their skills.
The Swift Concurrency Migration Guide
Swift 6 introduces more stringent concurrency checks to completely eliminate data races. Apple has published this guide on GitHub to help developers write code that complies with these strict checks once they are enabled. The guide is comprehensive and includes: an explanation of the concepts used by Swift's data-race safety model, guidance on how to enable complete concurrency checking in Swift 5 projects, techniques for the incremental adoption of concurrency, and strategies to address common issues.
肘子的话
WWDC 2024,AI 并非全部
苹果一直是 AI 领域的务实参与者,提供了卓越的设备端 AI 功能。然而,自从去年生成式 AI 的兴起,投资者、消费者、开发者都渴望苹果能够提供更加直观和感知丰富的 AI 技术。鉴于当前市场的需求,可以预见,在今年的 WWDC 2024 上,与 AI 相关的内容将占据极其重要的地位。
然而,即便撇开 AI 不谈,我预测 WWDC 2024 仍将是近年来议题最多、更新最为显著的一次。这主要基于以下两点原因:
首先,大有可能在本届 WWDC 上宣布 Swift 6 的发布。自 2019 年 Swift 5 推出以来,Swift 社区花了五年时间准备这一重大版本更新,这也是 Swift 发展史上时间间隔最长的一次。接下来,开发者将需要适应新语言特性和一些破坏性的更新,WWDC 2024 上必将围绕这些变化展开深入讨论。
其次,作为苹果生态中首个要求使用 SwiftUI 开发原生应用的硬件产品,年初推出的 Apple Vision Pro 将极大推动 SwiftUI 的发展。预计在本次大会上,SwiftUI 和 SwiftData 将获得重大功能提升,苹果也可能给出将 SwiftUI 定位为首要 UI 框架的明确信号。对于尚未学习或使用 SwiftUI 的开发者来说,这意味着需要投入更多精力去掌握这些新工具。
鉴于今年的 WWDC 充满看点,建议大家调整好状态,全情投入到一周后的盛会中。AI 虽然是亮点之一,但它绝非 WWDC 2024 的全部内容!
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
写在 WWDC 2024 之前:SwiftData 的未来潜力与现实挑战
在 2023 年的全球开发者大会(WWDC)上,苹果公司推出了备受期待的新一代数据管理框架 —— SwiftData。作为 Core Data 的继任者,SwiftData 是否能在苹果生态系统中扮演关键角色?随着 2024 年的 WWDC 迫近,本文将评估 SwiftData 自首次发布以来,在 Xcode 15 期间(即首个大版本)的整体表现,并对其未来发展进行展望。
在本文的结尾,列举了 SwiftData 首个版本中缺失的一些关键功能、主要存在的问题,以及若干临时的解决方案。
近期推荐
解密 AttributeGraph ( Untangling the AttributeGraph )
AttributeGraph 是一个基于 C++ 的私有框架,它在 SwiftUI 的背后默默发挥着关键作用,主要负责跟踪数据依赖关系以确定视图的更新时机。尽管在 SwiftUI 的架构中它扮演着至关重要的角色,相关文献却十分稀少。在本文中,Rens Breur 将展示如何通过堆栈跟踪来阅读和理解 AttributeGraph 的函数,以及如何利用 LLDB 命令行工具来调用和查看 AttributeGraph 的各种打印功能。此外,文章还探讨了如何利用 AttributeGraph 的特性来优化和理解 SwiftUI 中环境变量和偏好( PreferenceKey )的更新机制,并提供了一些实用的调试技巧和函数,帮助开发者更深入地理解和使用 AttributeGraph。
为 iOS 应用图标添加动画效果 ( Tricking iOS Into Animating App Icons )
在 iOS 系统中,通过替代应用图标系统(Alternate App Icons system),用户可以从预设的静态图像集中选择应用图标。本文中,Bryce Bostwick 探讨了如何通过频繁更换图标来创造动画效果的技术手段。文章详细介绍了如何利用私有 API 进行实现,并且阐释了相关的技术细节。尽管使用私有 API 会导致应用无法通过 App Store 的审核,但开发者仍可以通过这种方式了解到 iOS 系统图标处理机制的内部工作原理,为其他合规的创新应用提供灵感。
@preconcurrency 在 Swift 中的应用解析 ( @preconcurrency Usage in Swift Explained )
随着 Swift 6 的即将到来,越来越多的开发者在他们的项目中启用了严格的并发检查。在这一过程中,开发者们常常会发现,即便是使用官方框架时,编译器也会发出并发相关的警告。为了抑制这些警告,开发者通常会在导入模块前添加 @preconcurrency
。然而,@preconcurrency
的应用远不止于此。在本文中,Donny Wals 将详细介绍 @preconcurrency
的多种用途,@preconcurrency
不仅有助于将旧模块整合进新代码中,也使得新代码能够在旧项目中使用,从而为 Swift 6 的发布做好充分准备。
SwiftUI Mac 应用中的场景类型 ( Scenes Types in a SwiftUI Mac App )
在使用 SwiftUI 构建 macOS 应用程序时,了解并运用各种场景类型是创建多功能且高效应用的关键。每个窗口在 SwiftUI 中都对应一个场景(Scene),这些场景不仅包括常见的应用窗口(WindowGroup),还包含了 DocumentGroup、Settings、Window,以及位于系统菜单栏中的 MenuBarExtra。在本文中,Natalia Panferova 深入分析了这些场景类型的用途和实现方式,帮助开发者充分利用 SwiftUI 的强大功能,构建出更丰富、更高效的 macOS 应用程序。
用 WeatherKit 构建天气应用
WeatherKit 是由苹果开发的一个功能强大的天气信息框架,提供了大量的免费调用次数,极大地降低了开发者构建天气应用或为现有项目增添天气信息的门槛。在这一系列教程中,Stewart Lynch 将指导你通过结合 SwiftUI 和 WeatherKit,一步一步地构建一个完整的天气应用。这一系列共包含 7 个视频,不仅涵盖基础知识,还包括一些高级技巧,旨在帮助开发者充分利用这两个强大工具的潜力。
学习路径 ( Pathways )
对许多初次接触苹果开发生态的开发者来说,面对苹果提供的丰富而零散的资料常常会感到无从下手。为了解决这个问题,苹果特别设立了 Pathways 页面。这里针对设计、Swift、SwiftUI、游戏、visionOS 和 App Store 分发等多个领域,提供了明确的学习路径,集成了相关的文档、视频和其他资源。无论是初学者还是经验丰富的开发者,都可以在这里找到合适的指南,系统地学习和提升自己的技能。
Swift 并发迁移指南 ( The Swift Concurrency Migration Guide )
Swift 6 引入了更加严格的并发检查机制,以彻底消除数据竞争。苹果公司在 GitHub 上发布了这一指南,旨在帮助开发者在启用严格的并发检查后,能够正确编写符合规范的代码。该指南内容全面,包括:详解 Swift 的数据竞争安全模型、指导如何在 Swift 5 项目中开启完整的并发检查、如何渐进式采用并发技术,以及介绍解决常见问题的有效策略。
活动
线下派对:与 Apple 爱好者一起观看 WWDC24 Keynote
参与由 SwiftGG、XR 基地、少数派、初心资本、清华创客空间、西顾视频、超脑 AI 孵化器共同主办的 WWDC 2024 观看派对。这次活动将在 6 月 10 日同步在北京、上海、杭州和深圳举办,为 Apple 爱好者提供一个线下交流的平台,共同观看并讨论 WWDC 2024 的精彩瞬间。
抽奖公告
本次 WWDC 2024 愿望单征集活动已经圆满落幕。明年将继续举办此活动,期待大家届时能再次踊跃参与!点击查看中奖名单。