中文位于文章的下半部分
Weekly Comment
Recently, the iOS 17.3 Beta 2 version released by Apple encountered an unexpected issue, causing a boot loop problem in several devices, including the iPhone 15 Pro Max. Currently, it seems the only solution is to download and install the IPSW firmware. Although the Beta version is primarily aimed at developers, the emergence of such a serious issue is still surprising.
I initially thought Apple would spend more time refining its brand-new product, the Apple Vision Pro, but according to the latest news, it will be released on February 2nd. Given Apple's current performance in software quality control, I can't help but have some concerns about the stability and maturity of this product.
A few weeks ago, Apple allocated part of its software development team to focus a week on fixing some existing issues, but the results don't seem to be very noticeable. While writing an article about relationship handling in Core Data, I encountered a perplexing design in SwiftData, particularly in its handling of to-many relationships (which can lead to severe performance issues if mishandled). Another article recommended this week also highlighted problems with SwiftData's handling of pending changes. In summary, new errors continue to emerge, while old problems still remain unresolved.
I sincerely hope these problems do not continue to accumulate and evolve to a degree that severely impacts users and developers.
However, there is also some exciting news this week. It is said that Siri has made significant progress in utilizing generative AI, with surprises expected at this year's WWDC. I also hope that by mid-2024, Apple will make more innovations in integrating AI with development tools, bringing a richer and more efficient AI-assisted development experience to developers using Xcode.
I will continue to follow Apple's efforts to address current issues and drive technological innovation, looking forward to the positive changes they bring.
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
Mastering Relationships in Core Data: Fundamentals
In the numerous discussions about Core Data, “object graph management” undoubtedly appears as a core concept. As a renowned framework for object graph management, Core Data’s key task is how it precisely describes and effectively manages the complex relationships between different data instances. Indeed, the ability to manage relationships not only constitutes the core characteristic of Core Data but also represents a significant advantage over other data persistence frameworks. In this article, we will delve into the basic concepts of relationships in Core Data, while providing important guidance and suggestions for implementing these relationships.
Recent Selections
SwiftData Fetching Pending Changes
In Core Data, when we fetch data from persistent storage, the managed object context by default includes those pending changes (i.e., changes not yet persisted). SwiftData, as a successor to Core Data, should ideally have similar characteristics. However, in a similar configuration environment, SwiftData has not been as effective as Core Data in handling these changes. In this article, Keith Harrison delves deep into this issue, issuing a warning to developers currently using SwiftData.
AnyView’s impact on SwiftUI performance
This article discusses the potential impact on performance when using AnyView in SwiftUI. AnyView, as a type-erasing view, allows developers to avoid specifying the exact types of views in the view hierarchy, thus simplifying code complexity and reducing the frequent use of generics. However, this convenience may come at the cost of performance. The author, Martin Mitrevski, demonstrates the impact of AnyView on SwiftUI performance through meticulously designed test code. The article specifically points out that one should be cautious using AnyView in scenarios with scrollable lists containing a large number of subviews, to avoid unnecessary performance degradation.
How to use Stable Diffusion models in a Swift app
With the rise of Apple's silicon chip technology, an increasing number of developers are exploring open-source AI models on mobile devices to create innovative AI applications. In this article, Pol Piella thoroughly explains how to effectively utilize the Stable Diffusion model in Swift applications. He not only discusses how to use existing CoreML models in Swift apps but also demonstrates the specific steps for utilizing Apple's ml-stable-diffusion
library. Additionally, the article explains how to convert any model from the HuggingFace platform into a CoreML model using Apple's python_coreml_stable_diffusion.torch2coreml
script, thereby expanding the possibilities of implementing AI functionalities in Swift applications.
Workaround: Xcode simctl status_bar is still broken for iOS 17 simulators
simctl status_bar
, an important command-line tool, plays a crucial role in customizing the status bar information in iOS simulators. This tool adjusts various information displayed at the top of the screen, such as time, battery level, and network signal. Developers often rely on this tool to ensure consistency and a professional appearance of the status bar information when preparing App Store screenshots or other professional presentations. Unfortunately, on iOS 17 simulators, the functionality of simctl status_bar
has encountered obstacles, making traditional methods no longer applicable. In this article, Jesse Squires shares the temporary solution he found to address this issue. Given the current situation, the author predicts that this problem may not be resolved in the short term.
Git basics for iOS developers
This article, written by Donny Wals, aims to provide iOS developers with a basic understanding and overview of Git. Wals emphasizes that although there isn't a version of Git specifically tailored for iOS developers, understanding and mastering Git is crucial for those involved in iOS development. The primary goal of the article is to introduce the core concepts, commands, and fundamental principles of Git, assisting iOS developers to apply Git more effectively and efficiently in their work. Through this article, Wals offers a practical and comprehensive starting point for developers who wish to delve deeper into how Git can be utilized in the iOS development environment.
肘子的话
最近, 苹果发布的 iOS 17.3 Beta 2 版本出现了令人意外的问题, 使包括 iPhone 15 Pro Max 在内的多款设备出现了循环重启的情况。目前,似乎唯一的解决办法是下载 IPSW 固件进行刷机。虽然 Beta 版本主要面向开发者,但出现这种严重的问题仍然让人意外。
我原本以为苹果会花更多时间来打磨其全新产品 Apple Vision Pro,但根据最新消息,该产品将于 2 月 2 日上市。考虑到当前苹果在软件质量控制方面的表现, 我不免对该产品的稳定性和成熟度存有些许疑虑。
几周前,苹果让其部分软件开发团队用一周的时间来专注修复现有的一些问题,但效果似乎并不明显。在撰写关于 Core Data 关系处理的文章时,我发现了 SwiftData 在关系处理方面的一个严重性能问题(将在未来的文章中提供临时解决方案)。本周推荐的另一篇文章也指出了 SwiftData 在处理挂起更改时的问题。总的来说,新错误不断增加,旧问题仍没有得到改善。
我真心希望这些问题不要继续积累演变为对用户和开发者造成严重影响的程度。
当然,本周也有一些令人振奋的消息。据说 Siri 在使用生成式 AI 方面取得了显著进展,预计在今年的 WWDC 上将有惊喜亮相。我也希望在 2024 年中,苹果能在开发工具与 AI 结合方面做出更多创新,为使用 Xcode 的开发者们带来更加丰富和高效的 AI 辅助开发体验。
我将继续关注苹果在解决现有问题和推动技术创新方面的努力,期待它们带来的积极变化。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
掌握 Core Data 中的关系:基础
在众多关于 Core Data 的讨论中,“对象图管理”无疑是一个频繁出现的核心概念。作为一个颇具盛名的对象图管理框架,Core Data 如何精确描述并有效管理不同数据实例之间的复杂关系,成为了它的关键任务。事实上,管理关系的能力不仅构成了 Core Data 的核心特征,也是其相较于其他数据持久化框架的一大显著优势。在本文中,我们将深入探讨 Core Data 中关系的基本概念,同时提供关于实现这些关系的重要指导和建议。
近期推荐
SwiftData Fetching Pending Changes
在 Core Data 中,当我们从持久化存储中提取数据时,托管对象上下文默认会包含那些挂起的更改(即未被持久化的更改)。SwiftData,作为 Core Data 的后继技术,理应具有类似的特性。然而,在相似的配置环境下,SwiftData 并未能像 Core Data 那样有效地处理这些更改。在本文中,Keith Harrison 深入探讨了这一问题,向正在使用 SwiftData 的开发者发出了警示。
AnyView’s impact on SwiftUI performance
本文探讨了在 SwiftUI 中使用 AnyView 对性能可能造成的影响。AnyView 作为一种类型擦除视图,使得开发者无需明确指定视图层次结构中各个视图的具体类型,从而简化了代码的复杂度,避免了泛型的频繁使用。然而,这种方便性可能以牺牲性能为代价。作者 Martin Mitrevski 通过精心设计的测试代码,直观地展示了 AnyView 在 SwiftUI 中所造成的性能影响。文章特别指出,在包含大量子视图的滚动列表等场景中,应谨慎使用 AnyView,以避免不必要的性能下降。
How to use Stable Diffusion models in a Swift app
随着苹果硅芯片技术的兴起,越来越多开发者开始在移动设备上探索开源 AI 模型,以实现创新的 AI 应用。在这篇文章中,Pol Piella 详细介绍了如何在 Swift 应用程序中有效地利用稳定扩散(Stable Diffusion)模型。他不仅阐述了如何在 Swift 应用中运用现有的 CoreML 模型,还展示了使用苹果公司的 ml-stable-diffusion
库的具体步骤。此外,文章还讲解了如何借助苹果公司的 python_coreml_stable_diffusion.torch2coreml
脚本,将 HuggingFace 平台上的任何模型转换为 CoreML 模型,从而拓宽了在 Swift 应用中实现 AI 功能的可能性。
Workaround: Xcode simctl status_bar is still broken for iOS 17 simulators
simctl status_bar
作为一个重要的命令行工具,它在 iOS 模拟器中扮演着自定义状态栏信息的关键角色。该工具能够调整屏幕顶部状态栏显示的各种信息,如时间、电池电量和网络信号等。开发者在准备应用商店的截图或者进行其他专业演示时,经常依赖这一工具来确保状态栏信息的一致性和专业外观。不幸的是,在 iOS 17 模拟器上,simctl status_bar
的功能遭遇了障碍,传统的方法无法再被应用。在这篇文章中,jesse squires 分享了他为解决这一问题所找到的临时方案。鉴于目前的情况,作者预测这个问题短期内可能不会得到解决。
Git basics for iOS developers
本文由 Donny Wals 撰写,旨在为 iOS 开发者提供 Git 的基本知识和概览。Wals 强调,尽管没有专门为 iOS 开发者定制的 Git 版本,但对于从事 iOS 开发的人来说,了解并掌握 Git 是极其重要的。文章的主要目的是介绍 Git 的核心概念、命令和基本原则,帮助 iOS 开发者更有效和高效地在他们的工作中应用 Git。通过这篇文章,Wals 为那些希望深入了解如何在 iOS 开发环境中运用 Git 的开发者提供了一个实用且内容丰富的起点。