Weekly Comment
Apple Makes You a One-Day "Millionaire"
On April 11, 1976, Apple took a significant step with the debut of the Apple I computer, designed by Steve Wozniak. Although it was just a circuit board that required users to provide their own keyboard and monitor, its historical significance is profound as this product cemented Apple's position in the market.
Worth mentioning is an amusing incident that occurred a few days ago (April 11): a bug in Apple's App Store management website for developers led to many developers seeing their sales figures soar to millions of dollars within a short time. Although these figures were quickly corrected, this episode provided a light-hearted topic for the developer community and allowed some developers to briefly "taste" what it's like to be a millionaire.
Moreover, attracting more attention is a recent paper published by Apple's researchers titled Ferret-UI: Grounded Mobile UI Understanding with Multimodal LLMs. This paper introduces a new type of AI language model, "Ferret-UI," specifically designed to enhance the interactive experience of mobile device interfaces, such as those on iPhones and Androids, capable of performing complex reference and interaction tasks across various input forms.
The paper demonstrates that Ferret-UI excels in both basic and advanced UI tasks, surpassing other multimodal large language models and GPT-4V, further solidifying Apple's leadership in user experience and accessibility.
With the upcoming WWDC, Apple is expected to showcase more innovations in local AI and large language models. This paper gives us a glimpse into Apple's capabilities and the future direction in this field.
Previous Issue|Newsletter Archive
If you find this weekly newsletter or my blog helpful, I would greatly appreciate your consideration of making a donation through Patreon, or Buy Me a Coffee.
Originals
The @State Specter: Analyzing a Bug in Multi-Window SwiftUI Applications
In this article, we will delve into a bug affecting SwiftUI applications in multi-window mode and propose effective temporary solutions. We will not only detail the manifestation of this issue but also share the entire process from discovery to diagnosis, and finally, resolution. Through this exploration, our aim is to offer guidance to developers facing similar challenges, helping them better navigate the complexities of SwiftUI development.
Recent Selections
SwiftLog and OSLog: Choices, Usage, and Pitfalls
Logging tools are crucial for developers, serving an essential role in providing instant and accurate information during debugging and maintaining live applications. This article, written by Wang Wei, delves deeply into two logging frameworks in Swift development: SwiftLog and OSLog. SwiftLog is suitable for cross-platform applications or scenarios requiring highly customized log management; OSLog, on the other hand, is optimized for application development on Apple platforms. The article not only details log writing, reading, and performance handling but also highlights potential issues and pitfalls when using OSLog, providing developers with comprehensive guidance and practical advice.
Additionally, last week, Keith Harrison also explored how to retrieve OSLog messages in detail in his article Fetching OSLog Messages in Swift.
Splitting Up a Monolith: From 1 to 25 Swift Packages
Modular programming is a key feature in modern software development. While many developers recognize the importance of modularity, they often hesitate to overhaul existing projects due to the complexity or difficulty of starting such transformations. In this article, Ryan Ashcraft thoroughly details how he restructured a monolithic architecture into more than twenty-five Swift packages, including the challenges and compromises encountered during the process. Ryan is very satisfied with the outcome of the restructuring; although the size of the app's package increased, there was a significant improvement in build performance and SwiftUI previews. He hopes this article will provide insights and assistance to other developers considering similar restructurings.
Get Xcode Previews Working
The preview feature is a core aspect of SwiftUI, ideally boosting developers' efficiency significantly. However, due to its unique setup, many projects encounter frequent issues with this feature, leading to criticism from developers. In this article, Alexander discusses how to address common issues with Xcode previews and establish an effective preview environment. By sharing his personal experiences with the IronIQ project, he details the steps and strategies for configuring Xcode previews to support Swift Package Manager (SPM) and complex data stacks.
For a deeper understanding of the Preview feature's details and technical background, consider reading Behind SwiftUI Previews and Building Stable Preview Views: How SwiftUI Previews Work.
Syncing data with CloudKit in your iOS app using CKSyncEngine and Swift
While using the CloudKit API to fetch data from servers is relatively straightforward, real-time synchronization of local and cloud data presents numerous challenges, such as complex network environments, user permission constraints, and device power management policies. To simplify the developer's workload, Apple introduced the CKSyncEngine framework at WWDC 2023, already implemented in applications such as Freeform and NSUbiquitousKeyValueStore. In this article, Jordan Morgan thoroughly explains the steps and techniques to simplify data synchronization using CKSyncEngine, making it easier for developers to implement complex application syncs. This article is a valuable resource for iOS developers looking to enhance user experience and achieve seamless data synchronization.
Embracing Imaginary Spatial User Experience in visionOS
With the launch of Apple Vision Pro, spatial computing devices have opened new dimensions for user interaction and experience. In this article, Francesco Perchiazzi provides a series of design guidelines and frameworks aimed at helping designers and developers create more engaging and interactive applications for VisionOS. The article explores the basic principles of user experience, how to utilize psychological principles in spatial computing, and the historical application of space design in creative problem-solving. Additionally, Perchiazzi offers specific guidelines for designing spatial objects, emphasizing the importance of integrating psychological principles and user research to not only meet functional needs but also evoke emotional responses. Through these methods, developers can create truly captivating multisensory experiences, offering unprecedented ways of interaction for users.
HandVector
Although the Apple Vision Pro has been on the US market for a while, the number of applications developed for it remains limited. This is largely due to developers around the world being unable to test gesture operations in simulators without physical devices. To address this, Xander created HandVector, a library that offers an effective method for testing hand tracking on the visionOS simulator. This library includes a macOS helper application and a Swift class that connects via the Bonjour service and converts JSON data into gesture data. By using HandVector, developers can thoroughly test their applications without having physical devices, thus accelerating app development and market launch.
肘子的话
苹果助你成为一日“百万富翁”
1976 年 4 月 11 日,苹果公司迈出了重要一步,Steve Wozniak 设计的 Apple I 型电脑问世。尽管仅是一块需要用户自行添加键盘和显示器的电路板,但历史意义却极为重大,这款产品奠定了苹果公司的市场地位。
值得一提的是,几天前( 4 月 11 日 )发生的一个趣闻:苹果为开发者提供的 App Store 管理网站出现了 Bug,导致不少开发者在短时间内的销售额显示数据飙升至数百万美元。虽然这一数字很快被修正,但这一小插曲却为开发者社区带来了轻松的笑料,也让部分开发者暂时“尝到”了成为百万富翁的滋味。
除此之外,更受关注的是苹果的研究人员最近发表了一篇名为 Ferret-UI: Grounded Mobile UI Understanding with Multimodal LLMs 的论文。这篇论文介绍了一种新型 AI 语言模型“Ferret-UI”,该模型专为提升移动设备用户界面(如 iPhone 和 Android)的交互体验而设计,能在多种输入形式下执行复杂的参考和交互任务。
论文显示,Ferret-UI 在各项基础和高级 UI 任务中表现出色,其性能超越了现有的多模态大规模语言模型和 GPT-4V,再次证明了苹果在用户体验和可访问性领域的领先地位。
随着即将到来的 WWDC,苹果预计将展示更多关于本地 AI 和大型语言模型的创新。本篇论文为我们揭开了一角,展示了苹果在这一领域的实力和未来的发展方向。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
@State 魅影:一个多窗口模式下 SwiftUI 应用的 Bug 分析
在本篇文章中,我们将探讨一个影响多窗口模式下 SwiftUI 应用的 Bug,并提出有效的临时解决策略。我们不仅会详细描述这一问题的表现,还将分享从发现到诊断,最终解决问题的全过程。通过这一探索,旨在为遇到类似挑战的开发者提供一个指引,以帮助他们更好应对其他的 SwiftUI 开发难题。
近期推荐
SwiftLog 和 OSLog:选择、使用以及坑
日志工具对开发者至关重要,它们在调试和维护上线应用中扮演着提供即时且精确信息的角色。本文由王巍撰写,深入探讨了 Swift 开发中的两种日志记录框架:SwiftLog 和 OSLog。SwiftLog 适合于跨平台应用或需要高度定制的日志管理场景;而 OSLog 则专为 Apple 平台的应用开发优化。文章不仅详述了日志的写入、读取和性能处理,还指出了使用 OSLog 时可能遇到的问题和潜在陷阱,为开发者提供了全面的指导和实用建议。
此外,上周,Keith Harrison 也深入探讨了如何检索 OSLog 信息,详见其文章 Fetching OSLog Messages in Swift。
Splitting Up a Monolith: From 1 to 25 Swift Packages
模块化编程是现代软件开发中的一个关键特性。许多开发者虽然认识到模块化的重要性,但通常由于认为改造现有项目复杂或难以着手而望而却步。在本文中,Ryan Ashcraft 详细介绍了他如何将一个单体架构重构为超过二十五个 Swift 包的过程,包括这一过程中遇到的挑战和必须作出的权衡。重构的结果令 Ryan 非常满意,尽管应用的包大小有所增加,但构建性能和 SwiftUI 预览方面均获得了显著提升。他希望这篇文章能为其他开发者在进行类似重构时提供启示和帮助。
Get Xcode Previews Working
Preview 功能是 SwiftUI 的一项核心特性,理想状态下能显著提升开发者的工作效率。然而,由于其独特的构造,许多项目中的 Preview 功能常常出现问题,使得这项本应出色的功能频繁受到开发者的批评。在本文中,Alexander 介绍了如何解决使用 Xcode 预览时常见的问题,并建立一个有效的预览环境。通过分享其在 IronIQ 项目中的亲身经历,作者详细阐述了为支持使用 Swift 包管理器(SPM)和复杂的数据堆栈配置 Xcode 预览环境的步骤和策略。
若要深入了解 Preview 功能的更多细节和技术背景,建议阅读 Behind SwiftUI Previews 和 构建稳定的预览视图 —— SwiftUI 预览的工作原理。
Syncing data with CloudKit in your iOS app using CKSyncEngine and Swift
虽然开发者使用 CloudKit API 从服务器获取数据相对简单,但实时处理本地与云端数据的同步则面临许多挑战,如复杂的网络环境、用户权限限制及设备的电量管理策略等。为了简化开发者的工作,苹果在 2023 年的 WWDC 中推出了 CKSyncEngine 框架,并已在其应用如 Freeform 和 NSUbiquitousKeyValueStore 中采用。Jordan Morgan 在本文中详细介绍了使用 CKSyncEngine 来简化数据同步的步骤和技术,使得开发者可以更容易地实现复杂应用的数据同步。这篇文章是为那些希望提高应用用户体验并实现流畅数据同步的 iOS 开发者提供的宝贵资源。
Embracing Imaginary Spatial User Experience in visionOS
随着 Apple Vision Pro 的推出,空间计算设备(Spatial Computer)为用户交互和体验开辟了新的维度。Francesco Perchiazzi 在这篇文章中提供了一系列设计指导原则和框架,旨在帮助设计师和开发者为 VisionOS 创建更具吸引力和互动性的应用。文章详细探讨了用户体验的基本原则,如何利用空间计算中的心理学原理,以及空间设计在创意解决问题中的应用历史。此外,Perchiazzi 也提供了一些具体的设计空间对象的指南,强调了结合心理学原理和用户研究的重要性,这不仅能满足功能需求,还能激发用户的情感反应。通过这些方法,开发者可以创造出真正引人入胜的多感官体验,为用户带来前所未有的交互方式。
HandVector
虽然 Apple Vision Pro 已在美国市场上销售一段时间,但针对其开发的应用数量仍较少。这在很大程度上是由于全球各地的开发者在没有实体设备的情况下,难以在模拟器中对手势操作进行测试。为此,Xander 创建了 HandVector 这一库,它提供了一种在 visionOS 模拟器上测试手部跟踪的有效方法。此库包括一个 macOS 辅助应用程序和一个 Swift 类,这个类通过 Bonjour 服务进行连接,并将 JSON 数据转换为手势数据。通过使用 HandVector,开发者可以在还未获取实体设备的情况下,对其应用进行全面测试,从而加速应用开发和上市进程。