Weekly Comment
Ultra-Wide Virtual Display is Great, But We Expect More
The release of visionOS 2.2 beta finally brings the long-awaited "wide" and "ultra-wide" virtual display modes to Apple Vision Pro. In ultra-wide mode, users are presented with an expansive display space that transcends physical field of view limitations. Although Apple Vision Pro has its hardware resolution constraints, thanks to Foveated Rendering technology, the virtual display is not only clearer than before but also delivers a visual experience comparable to an 8K display.
The introduction of this feature has delighted many Apple Vision Pro users, who have eagerly retrieved their shelved devices to immerse themselves in the new ultra-wide display experience. From my personal experience, the ultra-wide virtual display creates a unique sense of immersion for development work, allowing me to maintain focus for extended periods — until the device's weight interrupts this immersive experience.
The ultra-wide mode is likely to extend users' daily usage time and may also spawn new application forms — macOS desktop applications specifically optimized for Apple Vision Pro's ultra-wide display. From a certain perspective, the success of the virtual display feature seems somewhat "counterintuitive": Apple originally envisioned Apple Vision Pro as a standalone spatial computing device independent of other devices. Nevertheless, the enhancement of virtual display functionality is undoubtedly a significant benefit for existing users and demonstrates Apple's commitment to continuously improving the visionOS ecosystem.
The introduction of ultra-wide virtual display proves that Apple Vision Pro's hardware potential remains largely untapped. As Apple releases more functional APIs, developers may create innovative experiences beyond imagination for this device. While these improvements may not immediately lead to significant sales growth, the ability to explore more possibilities in spatial computing is enough to demonstrate the historical value of this first-generation product.
Notably, the virtual display functionality doesn't rely on some of the "premium" components in Apple Vision Pro (which have limited functionality while adding cost and weight). While maintaining core computing capabilities, introducing a more affordable model would undoubtedly attract more potential users who are currently on the fence. We look forward to Apple Vision Pro unleashing more exciting potential in the future.
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
Mastering Data Tracking and Notifications in Core Data and SwiftData
Core Data and SwiftData, as powerful persistence frameworks in the Apple ecosystem, not only provide declarative data listening tools like @FetchRequest
and @Query
, but also have a complete set of data tracking and notification mechanisms built-in. Understanding and mastering these mechanisms is crucial for building robust data-driven applications. This article will take you through multi-layered solutions—from simple custom notifications to the powerful Persistent History Tracking and SwiftData History—to help you handle various complex data synchronization scenarios.
Recent Selections
Swift Ownership and ~Copyable
Rust’s ownership system ensures memory safety through strict rules, making it widely used in systems programming and high-performance computing. The Swift team has also recognized the importance of ownership, introducing related features in version 5.9 and refining them further in Swift 6.0. In this article, Wei Wang (Onevcat) delves into Swift’s ownership system and keywords like ~Copyable
. He points out that while understanding ~Copyable
isn’t essential for all Swift developers, it can significantly enhance code stability and efficiency in scenarios involving resource exclusivity and lifecycle management.
Developing in Swift with VS Code Dev Containers
Dev Containers are a technology that uses Docker containers as a full-featured development environment, ideal for running applications, isolating development tools and dependencies, and supporting continuous integration and testing. In short, Dev Containers allow developers to run and debug executables within Docker containers, ensuring consistency between local development and remote deployment environments. In this series, Natan Rolnik explores how to leverage VS Code Dev Containers for Swift development, showcasing how this technology streamlines the development workflow.
Being Sendable with SwiftData
In SwiftData, you can use a PersistentIdentifier
that conforms to the Sendable protocol to ensure thread-safe data transmission across threads. However, this often results in the loss of type information for models. In this article, Leo G Dion presents a solution by constructing a Phantom Type structure to retain type information while passing identifiers, thereby achieving thread safety without sacrificing model type identification.
Swift Format in Xcode
In Apple’s development ecosystem, two similarly named yet functionally similar code formatting tools exist: SwiftFormat by Nick Lockwood, which offers rich customization, and Apple’s own swift-format, built into Xcode 16. In this article, Sarah Reichelt tests swift-format
and compares it to tools like SwiftLint and Prettier. She hopes that Apple or the Swift community will eventually introduce a Swift style guide, alongside support for auto-formatting on save, to further enhance the development experience.
SwiftUI Self-Sizing Flow Layouts
Starting with iOS 16, SwiftUI offers the Layout protocol, allowing developers to build custom layout containers. In this article, Keith Harrison explores how to achieve a UICollectionViewFlowLayout-like effect in SwiftUI, enabling automatic adjustment of the number of items per row or column.
Unfortunately, the Layout protocol currently lacks support for lazy loading, limiting its effectiveness for handling large datasets.
On Device Llama 3.1 with Core ML
Official Apple documentation. This article provides an in-depth guide on deploying the Llama 3.1 mid-sized language model on Apple Silicon devices, optimized for real-time applications. Using optimizations like Key-Value Caching and block-level Int4 quantization on macOS Sequoia, the 8B parameter Llama-3.1-8B-Instruct model achieves a decoding speed of approximately 33 tokens per second, significantly enhancing local inference efficiency.
Event
Let's visionOS 2025
Let's visionOS 2025 will be held in Shanghai, China, from February 28 to March 2, 2025. Let's visionOS is the world’s first conference focused on spatial computing and Apple Vision Pro app development, and it was successfully held in Beijing earlier this year. The 2025 theme will further expand to include spatial computing, artificial intelligence, and iOS. For more details, please visit the official website.
肘子的话
超宽虚拟屏很棒,但我们期待更多
visionOS 2.2 测试版本的发布,终于为 Apple Vision Pro 带来了期待已久的“宽”和“超宽”虚拟屏幕模式。在超宽模式下,使用者眼前会呈现出一个可以超越物理视野限制的庞大显示空间。尽管 Apple Vision Pro 的硬件分辨率有其局限性,但得益于焦点渲染(Foveated Rendering)技术的加持,虚拟屏幕不仅较此前更为清晰,更能带来堪比 8K 显示器的视觉体验。
这项功能的推出让不少 Apple Vision Pro 用户十分欣喜,纷纷重拾已经搁置的设备,沉浸在超宽屏幕带来的全新体验中。就我个人的使用体验而言,超宽虚拟屏幕为开发工作营造了一种独特的沉浸感,能让我在相当长的时间内保持专注 —— 直到设备的佩戴重量打断这种沉浸体验。
超宽模式很可能会延长用户的日常使用时长,同时也可能催生新的应用形态——专门针对 Apple Vision Pro 超宽屏幕优化的 macOS 桌面应用。从某种角度来看,虚拟屏幕功能的成功倒是显得有些“反直觉”:苹果原本期望将 Apple Vision Pro 打造成一款不依赖其他设备的独立空间计算设备,但无论如何,虚拟屏幕功能的增强无疑是对现有用户的重大利好,也展现了苹果持续完善 visionOS 生态的决心。
超宽虚拟屏幕的推出证明了 Apple Vision Pro 的硬件潜力远未被充分释放。随着苹果开放更多功能性 API,开发者有望为这款设备创造出更多突破想象的创新体验。虽然这些改进可能不会立即带来销量的显著提升,但能在空间计算领域开拓更多可能性,也足以彰显首代产品的历史价值。
值得注意的是,虚拟屏幕功能并不依赖 Apple Vision Pro 上的一些“高大上”组件(功能有限、徒增成本和重量)。在保持核心计算能力的前提下,推出一款更为亲民的产品型号,无疑能吸引更多持观望态度的潜在用户。期待 Apple Vision Pro 能在未来释放出更多令人惊喜的潜能。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
掌握 Core Data 和 SwiftData 中的数据追踪与通知
Core Data 和 SwiftData 作为 Apple 生态系统中强大的持久化框架,不仅提供了 @FetchRequest
和 @Query
这样的声明式数据监听工具,更内置了一套完整的数据追踪与通知机制。了解和掌握这些机制对于构建健壮的数据驱动型应用至关重要。本文将带你探索从简单的自定义通知,到强大的持久化历史追踪(Persistent History Tracking 和 SwiftData History)等多层次的解决方案,助你应对各种复杂的数据同步场景。
近期推荐
逆流而上的设计 - Swift 所有权和 ~Copyable
Rust 的所有权系统以严格的规则确保内存安全,广泛应用于系统编程和高性能计算。Swift 开发团队同样早已认识到所有权的重要性,并在 5.9 版本中首次引入了相关特性,随后在 6.0 版本进一步完善。本文中,王巍深入探讨了 Swift 的所有权机制及 ~Copyable
等关键字,指出尽管理解 ~Copyable
并非 Swift 开发的必修课,但在资源独占、生命周期控制等场景中,它将显著提升代码的稳定性和效率。
使用 VS Code Dev Containers 进行 Swift 开发 (Developing in Swift with VS Code Dev Containers)
开发容器(Dev Containers)是一种将 Docker 容器用作完整开发环境的技术方案,适用于运行应用程序、隔离开发工具和依赖库,同时支持持续集成与测试。简而言之,Dev Containers 允许开发者在 Docker 容器中运行和调试可执行文件,确保本地开发和远程部署环境的一致性。在本系列文章中,Natan Rolnik 将深入介绍如何使用 VS Code Dev Containers 进行 Swift 开发,并展示如何通过这一技术简化开发流程。
在 SwiftData 中实现 Sendable (Being Sendable with SwiftData)
在 SwiftData 中,使用符合 Sendable 协议的 PersistentIdentifier
可以确保在多线程环境下安全传递数据,但这往往会导致丢失模型的类型信息。本文中,Leo G Dion 提出了一种解决方案,即通过构建一个幻影类型(Phantom Type)结构体,在传递标识符的同时保留数据类型信息,确保线程安全的同时仍能辨别模型类型。
在 Xcode 中格式化 Swift 代码 (Swift Format in Xcode)
在苹果的开发生态中,有两个名称相近、功能相似的代码格式化工具:由 Nick Lockwood 开发的 SwiftFormat 提供了更丰富的定制选项,而苹果自己开发并集成到 Xcode 16 中的 swift-format 则是内置的选择。在这篇文章中,Sarah Reichelt 测试了 swift-format
,并将其与 SwiftLint 和 Prettier 等工具进行了对比。她期望 Apple 或 Swift 社区能在未来推出 Swift 风格指南,同时支持自动保存时进行格式化,以进一步提升开发体验。
SwiftUI 自适应流式布局 (SwiftUI Self-Sizing Flow Layouts)
自 iOS 16 开始,SwiftUI 提供了 Layout 协议,开发者可以利用它构建自定义的布局容器。Keith Harrison 在本文中探讨了如何在 SwiftUI 中实现类似 UICollectionViewFlowLayout 的效果,实现每行或每列项目数的自动调整。
遗憾的是,Layout 协议当前仍然不支持懒加载,这使其在处理大数据量场景时受到限制。
在 Apple 设备上运行 Llama 3.1 与 Core ML (On Device Llama 3.1 with Core ML)
苹果官方文档。详细介绍了如何在 Apple Silicon 设备上部署中型大语言模型 Llama 3.1,并通过一系列优化提升性能以支持实时应用。在 macOS Sequoia 上,采用状态缓存(Key-Value Cache)和块级 Int4 量化等技术优化后,8B 参数量的 Llama-3.1-8B-Instruct 模型能够实现约 33 tokens/s 的解码速度,显著提升了本地推理效率。
活动
Let's visionOS 2025
Let's visionOS 2025 将于 2025 年 2 月 28 日至 3 月 2 日在中国上海举办。Let's visionOS 是全球范围内首个聚焦于空间计算和 Apple Vision Pro 应用与开发的大会,并在今年初于北京成功举办。2025 年的活动主题将进一步扩展,涵盖空间计算、人工智能和 iOS 领域。更多活动详情请关注官网。