Weekly Comment
Experience the joy of pixel games on your iPhone!
Apple recently updated its App Store Review Guidelines, now allowing emulator apps into the App Store. Just a few days ago, an emulator app named Delta was launched on the store. Delta is an all-in-one emulator designed for iOS, supporting a variety of Nintendo handheld games. This app was actually developed a long time ago but was previously only available to users in non-App Store formats due to policy restrictions.
I downloaded the app as soon as I could, and when those familiar game background tunes started playing, it felt as if I had traveled back to my gaming days years ago. While these classic games can't compete with modern games in terms of graphics and sound, their excellent gameplay is still captivating to this day. Playing these refined and simple pixel games made me wonder, have today's games and apps become too bloated?
New hardware platforms allow us to use resources freely without worrying about efficiency, and developers have gradually gotten used to consuming a large amount of resources. However, as hardware and development tools continue to advance, have the applications we create genuinely improved?
This Sunday, I received the SwiftIO Playground Kit from MadMachine, a development board equipped with a 600MHz MCU, 32MB RAM, and 16MB Flash. Its biggest feature is that it supports development using Swift, which is perfect for developers like me who are familiar only with Swift. I plan to work on some small projects on this hardware, trying to curb my growing demand and consumption of resources.
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
Core Data Reform: Achieving Elegant Concurrency Operations like SwiftData
SwiftData, as the successor to Core Data, has introduced a multitude of innovative and modern design ideas. Despite its availability for some time now, many developers have yet to adopt it in their projects. This situation is partly due to SwiftData’s higher requirements for the operating system version. Additionally, because SwiftData is not yet mature enough in some functionalities, developers might choose to continue using Core Data even if their operating system version meets SwiftData’s requirements. Can we integrate some of SwiftData’s excellent design philosophies and ingenious implementations into the practical use of Core Data? This article aims to explore how to introduce elegant and safe concurrency operations similar to those of SwiftData into Core Data, implementing a Core Data version of @ModelActor
.
Recent Selections
Is Dynamic Isolation Bad?
In Swift programming, keywords such as nonisolated
, isolated
, and actor
create what's known as static isolation. This method allows developers to clearly express isolation needs to the compiler through the type system, greatly reducing the risk of potential errors. Moreover, Swift also provides tools for dynamic isolation to help developers gracefully handle existing non-concurrent code. In this article, Matt Massicotte deeply explores the pros and cons of using static versus dynamic isolation. Initially, he was opposed to using MainActor.run
for dynamic isolation. However, after receiving detailed feedback from Rob Napier, he gained a more comprehensive understanding and perspective on the topic.
How to learn TCA
The Composable Architecture (TCA) is an open-source framework launched by Point-Free that integrates tools for state management, component assembly, side effect handling, and testing, aimed at helping developers build applications. Opinions on TCA are mixed: some developers believe it complicates issues, while others see it as an ideal choice when used with SwiftUI. Regardless of the viewpoint, understanding the framework can undoubtedly bring significant benefits in state management, side effect handling, and test planning. In this article, Andrew Harrison offers a guided path on how to start learning TCA. The main purpose of the article is not to directly teach how to use TCA but to provide a good starting point for learning the framework.
Last week, Antoine Lee also discussed the topic related to TCA in the tweet Is TCA the new MVVM?, which interested readers can join.
Towards Building User-Centric Indie Apps
During my trip to Beijing at the end of March, I discussed with Junping his application in development — Context. This app impressed me with its unique interaction methods. "Context" is a fast and precise multilingual dictionary that uses large language models to explain new vocabulary based on the specific context of words. In this article, Junping shares his experience in developing the application. He emphasizes the importance of user-centric design and details the entire development process from inspiration to product launch. Importantly, Junping also shares all the related documents used during the conception and design phases, including planning and Figma documents, to help other developers better understand and apply user-centric design principles.
How to migrate an iOS app to Bazel
Bazel is an open-source multi-language build system widely used in large projects and codebases. It improves build speed, reuse, scalability, and diversity by leveraging build caching and parallel task execution. In this detailed guide, Brentley Jones explains how to migrate an iOS app from Xcode to Bazel. The process includes basic Bazelisk installation, defining build targets, converting an Xcode project, and integrating Xcode. The article uses the Mastodon iOS project as an example, covering various aspects from using rules such as swift_library
and ios_application
to optimizing build performance with remote caching and execution. This article is a valuable resource for iOS developers looking to enhance their project's build efficiency and manage complexity.
Common Mistakes to Avoid When Using Enums in Swift
Enums are a powerful tool in Swift, offering features not available in many other programming languages. In this article, Leonardo Pugliese discusses several common mistakes iOS developers make when using enums in Swift, including lack of cohesion in mapping values, lazy switching, misuse of the default clause, and incorrect assumptions about automatic raw value incrementation. The article emphasizes thoughtful coding practices, the value of type safety, and the benefits of avoiding shortcuts that compromise code quality. Pugliese reminds readers that good coding practices and attention to detail can significantly improve the reliability and maintainability of software.
肘子的话
用 iPhone 感受像素的游戏的快乐!
苹果公司最近更新了应用商店审核指南,现在允许模拟器应用进入 App Store。就在几天前,名为 Delta 的模拟器应用登陆了应用商店。Delta 是一款为 iOS 设计的综合模拟器,支持多种任天堂掌机游戏。这款应用其实很早以前就已经开发完成,但之前由于政策限制,只能以非商店形式提供给用户。
我在第一时间下载使用了这款应用,当那些熟悉的游戏背景音乐响起,仿佛又带我回到了多年前的游戏时光。虽然这些经典游戏在画面和声音上无法与现代游戏媲美,但它们出色的游戏性至今仍让人沉迷。在玩这些精致而简洁的像素游戏时,我不禁思考,现在的游戏或应用是否变得过于庞大了。
新的硬件平台让我们可以在不担心效率的情况下尽情使用资源,开发者也逐渐习惯了对资源的大量消耗。但在硬件和开发工具不断进步的同时,我们创建的应用真的有相应的提升吗?
这个周日,我收到了来自 MadMachine 的 SwiftIO Playground Kit,一款配备 600MHz MCU、32MB RAM 和 16MB Flash 的开发板。其最大的特点是支持使用 Swift 进行开发,非常适合像我这样熟悉 Swift 的开发者。我计划在这块硬件上实现一些小项目,试图克制自己对资源日益增长的需求和消耗的习惯。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
Core Data 改革:实现 SwiftData 般的优雅并发操作
SwiftData,作为 Core Data 的后继者,引入了众多创新和现代化的设计思想。尽管它已经推出一段时间,但许多开发者还未在他们的项目中采用。这种状况部分是因为 SwiftData 对操作系统版本的要求较高,另一方面,由于 SwiftData 在某些功能方面还不够成熟,即便操作系统版本符合要求,开发者也可能因为功能限制而选择继续使用 Core Data。我们是否能将 SwiftData 中的一些卓越设计理念和巧妙实现,融合到 Core Data 的实际使用中呢?本文旨在探讨如何在 Core Data 中引入类似 SwiftData 的优雅和安全的并发操作,以实现一个 @ModelActor
的 Core Data 版本。
近期推荐
Is Dynamic Isolation Bad?
在 Swift 编程中,nonisolated
、isolated
和 actor
等关键字构成了所谓的静态隔离。这种方法允许开发者通过类型系统明确地向编译器表达隔离需求,大大减少潜在的错误风险。此外,Swift 还提供了动态隔离的工具,以帮助开发者优雅地处理现有的非并发代码。在这篇文章中,Matt Massicotte 深入探讨了使用静态隔离与动态隔离的利弊。最初,他对使用 MainActor.run
进行动态隔离持反对态度。但在接受了 Rob Napier 的详尽反馈后,他对此话题有了更全面的理解和思考。
How to learn TCA
The Composable Architecture(TCA)是由 Point-Free 推出的一个开源框架,它整合了状态管理、组件组装、副作用处理及测试等工具,旨在帮助开发者构建应用程序。对 TCA 的评价褒贬不一:一些开发者认为它使问题复杂化,而另一些人则视其为与 SwiftUI 搭配使用时的理想选择。不论观点如何,了解该框架无疑能在状态管理、副作用处理、以及测试规划方面为开发者带来显著的益处。在本文中,Andrew Harrison 提供了一个关于如何开始学习 TCA 的指导路径。文章的主旨不在于直接教授 TCA 的使用方法,而是提供一个学习该框架的好的起点。
在上周中,Antoine Lee 也在 Is TCA the new MVVM? 的推文中讨论了与 TCA 相关的话题,感兴趣的朋友可以参与其中。
探索打造以用户为中心的独立应用
在三月底的北京之行中,我与 Junping 交流了他正在开发中的应用—— 语境词典 (Context)。这款应用以其与众不同的交互方式给我留下了深刻印象。《语境词典》是一个快速而精确的多语言词典,通过大型语言模型根据词语的具体上下文来解释新词汇。在这篇文章中,Junping 分享了他在开发该应用时的经验。他强调了以用户为中心设计的重要性,并详细介绍了从灵感来源到产品发布的整个开发流程。尤其珍贵的是,Junping 还分享了他在构思和设计过程中使用的所有相关文件,包括设计规划和 Figma 文档,旨在帮助其他开发者更好地理解和应用以用户为中心的设计理念。
How to migrate an iOS app to Bazel
Bazel 是一个开源的多语言构建系统,广泛应用于大型项目和代码库中。它通过利用构建缓存和并行执行任务来提高构建速度、重复使用、可扩展性和多样性。在这篇详尽的指南中,Brentley Jones 介绍了如何将 iOS 应用从 Xcode 迁移到 Bazel。这个过程包括基础的 Bazelisk 安装、定义构建目标、转换 Xcode 项目、以及集成 Xcode。文章以 Mastodon iOS 项目作为实例,涵盖了从使用 swift_library
和 ios_application
等规则到利用远程缓存和执行优化构建性能的多个方面。这篇文章是希望提高其项目构建效率和管理复杂性的 iOS 开发者的宝贵资源。
Common Mistakes to Avoid When Using Enums in Swift
枚举是 Swift 语言中的一个强大工具,具有许多其他编程语言所不具备的特性。Leonardo Pugliese 的这篇文章探讨了 iOS 开发者在使用 Swift 中的枚举时常见的几个错误,包括映射值时缺乏凝聚力、懒惰的 Switch 和默认子句的误用,以及错误地假设自动原始值递增。文章强调了深思熟虑的编码方式、类型安全的价值,以及避免损害代码质量的捷径的重要性。作者提醒读者,良好的编码实践和对细节的关注可以显著提高软件的可靠性和可维护性。