Weekly Comment
Innovation Comes in Many Forms
Just hours after Apple released the iPhone 16, Huawei introduced the Mate XT at its own product launch, marking the world's first mass-produced triple-folding smartphone. The device instantly captivated attention with its unique design and intricate mechanical structure.
In recent years, Apple's iPhone series has undergone minimal aesthetic changes, rendering the Mate XT's arrival a breath of fresh air, and immediately highlighting an innovation in form factor. However, after the initial excitement subsided, some began to question: Given its high price and the inherent limitations of foldable screens, is the Mate XT merely innovating for the sake of innovation, offering little practical value to the average consumer?
As a company severely affected by sanctions, Huawei has faced substantial challenges. With chip manufacturing capabilities constrained, Huawei’s mobile devices have not matched the computing power and energy efficiency of the world's leading equipment. In this context, launching products with unique and talk-worthy features is undoubtedly a smart marketing strategy. However, Huawei didn’t just stop with gimmicks; they have pushed the envelope in materials, manufacturing processes, software adaptation, and more, carving out an effective route for innovation despite significant restrictions.
As breakthroughs in manufacturing processes emerge over the next few years, Huawei is poised to reach a level of computing power and energy efficiency on par with leading mainstream brands, complemented by the maturation of its native HarmonyOS and its development ecosystem. At that point, Huawei is likely to further demonstrate its innovative capabilities across various domains, allowing more consumers to directly experience the fruits of innovation.
Turning to Apple, despite the high degree of similarity between recent iPhone generations and only incremental annual performance enhancements, Apple has continued to forge ahead, particularly in imaging capabilities, with a strong emphasis on video. As network speeds have surged and the cost of cloud storage has plummeted, video is increasingly becoming the preferred medium for documenting life and expressing oneself, with the potential to reshape our lifestyle and work modalities. When this transformation reaches a tipping point, the once negligible "micro-innovations" will unleash astounding potential. Apple’s sustained focus on video technology is set to culminate in a landmark innovation, likely as impactful as the original iPhone, which seamlessly integrated an iPod, a browser, and a phone. In time, the emerging technology of spatial video capture and display is expected to solidify its place as another robust component of Apple's ecosystem.
Innovation manifests in varied forms; some instantly captivate users, while others require time to manifest their true value. Both Huawei and Apple continue to introduce market-acclaimed products, leveraging their respective market conditions, technological reserves, and traditional strengths, showcasing formidable innovation and integration capabilities. In the ever-evolving technological landscape, innovation remains the pivotal force driving progress.
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!
Recent Selections
The weirdest Core Data crash I have seen
During the use of Core Data, Filip Němeček encountered an unusual problem: the application would crash whenever attempting to assign a value to a property starting with new
. After some investigation, he identified the root of the issue—a rather old setting from Apple's system: in an Automatic Reference Counting (ARC) environment, properties cannot start with new
. Filip documents this discovery in this article and shares relevant information to help other developers save time on this issue.
Although the default implementation of SwiftData is currently based on Core Data, since SwiftData does not declare a separate
NSManagedObject
subclass for Model, this naming constraint does not apply, and developers are still free to usenew
as a prefix for property names.
SwiftUI's Observable macro is not a drop-in replacement for ObservableObject
Due to its more precise response mechanism, the @Observable
macro is considered a potential replacement for ObservableObject
in the SwiftUI framework. However, differences in their underlying implementation and initialization mechanisms cause significant behavioral differences in some cases. In this article, Jesse Squires delves into how these differences affect app behavior and illustrates potential issues that may arise during use. Additionally, the author discusses problems within SwiftUI's state management system and suggests adopting a more rational architecture to avoid these issues and help developers optimize their SwiftUI applications.
SwiftData Expressions
In its first version, SwiftData lacked the capability to build complex predicates similar to NSExpression
. Thanks to the newly introduced #Expression
macro, this shortcoming has been improved in iOS 18. In this article, Keith Harrison introduces how to use this new API to build compound predicates for efficient filtering at the database end. Although the #Expression
macro theoretically expands the expressive capabilities of SwiftData, the author notes that the use of predicates and expressions still faces some limitations and challenges in practical applications.
Converting an App from Obj-C
The App Store issues warnings to long-unupdated apps, which can lead to removal if not updated by a given deadline. Sarah Reichelt recently faced this challenge. Her app was originally written in Objective-C, and in this forced update, Reichelt opted to refactor it using the modern SwiftUI framework. In this article, she shares the technical challenges encountered during the conversion process, the solutions adopted, and insights gained from this experience.
Swift Testing: Validate your code using expressive APIs
The Swift Testing framework, by offering clear and expressive APIs, completely transforms the way tests are written in Swift. This framework simplifies the coding of tests, allowing developers to write and manage tests more intuitively. In this article, Antoine van der Lee introduces this new framework, showing how to simplify test assertions using the global definition and the #expect
macro. The author promises to provide a series of in-depth articles in the coming weeks, including how to migrate existing XCTests to Swift Testing.
The Memory Leak: An Xcode Detective Story
Due to a memory leak issue, Jacob Bartlett's application encountered a bug where responding to deep links would cause the navigation animation to appear twice. In this article, he details the debugging process, from analyzing the problem to confirming its source, and finally resolving it. Additionally, he discusses Swift's memory management mechanisms, including strong and weak references, and how reference counting works.
visionOS 2 PortalComponent: A teleportation wonder that better meets expectations
PortalComponent
creates a visual "portal" in real scenes, through which users can see and interact with different virtual environments or scenes. This feature has been further enhanced in visionOS 2. In this article, Puffinwalker introduces two new modes: Clipping
and Crossing
, which significantly improve the reality extension effect, allowing models within the Portal to extend more naturally into the outside world.
肘子的话
创新可以有很多种
苹果在发布 iPhone 16 几小时后,华为也举行了新品发布会,推出了全球首个量产的三折屏手机 Mate XT。这款产品以其独特造型和精巧机械结构一亮相便吸引了众多关注。
近年来,苹果的 iPhone 系列在外观上变化不大,这让 Mate XT 的登场带来了一种耳目一新的感觉,使人立即感受到形态上的创新。然而,兴奋之余,一些人开始质疑:考虑到其相对较高的价格和折叠屏的局限性,Mate XT 是否只是为了创新而创新,对普通消费者而言实际意义不大?
作为一家饱受制裁影响的企业,华为近年来面临巨大挑战。由于芯片制程受限,华为的移动产品在算力和能效比方面与世界顶级设备存在一定差距。在这种情况下,推出具有话题性和独特性的产品无疑是一种聪明的市场策略。华为并没有止步于此,他们在材料、生产工艺、软件适配等多个方面都做出了创新和突破,可谓在当前受限状况下找到了一条有效的创新之路。
随着未来几年制程工艺的突破,当华为具备了与主流一线品牌相当的算力和能效比,加上原生鸿蒙系统和相应开发生态的成熟,华为必将在主流移动设备形态上展现出更强的竞争力。届时,他们很可能会在其他方面展示其创新能力,让更多消费者切身体验到创新的成果。
至于苹果,虽然近几代 iPhone 外观相似,每年的性能提升已难以让消费者感受到明显变化,但苹果在影像能力尤其是视频方面的持续深耕,已在行业中取得了不小的领先优势。随着网络速度的快速提升和云存储成本的持续下降,视频正成为大众记录生活、表达自我的首选方式,甚至有望重塑我们的生活与工作模式。当这种变革积累到一定程度,曾被忽视的"微创新"将爆发出惊人的力量。苹果在视频技术领域的多年积累,终将凝结为一个划时代的产品标签,其影响力不亚于 iPhone 初次集成 iPod、浏览器和手机功能时的革命性创新。届时,现在还显新奇且小众的空间视频拍摄与展示技术,也将成为苹果生态系统中的又一道坚固的护城河。
创新的形式可以千变万化,有些创新能立即让使用者眼前一亮,而有些则需要时间来彰显其价值。无论是华为还是苹果,它们都依据自身的市场环境、技术储备和传统优势,持续推出受市场欢迎的产品,展现出强大的创新能力和整合实力。在这个快速变化的科技世界里,创新永远是推动发展的核心动力。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
近期推荐
我遇到的最奇怪的 Core Data 崩溃 (The weirdest Core Data crash I have seen)
在使用 Core Data 过程中,Filip Němeček 遭遇了一个异常问题:每当尝试为以 new
开头的属性赋值时,应用便发生崩溃。经过一番排查,他找到了这一问题的根源——一个源自苹果系统的较为古老的设定:在自动引用计数(ARC)环境下,属性命名不得以 new
开头。Filip 在本文中记录了这一发现,并分享了相关资料,目的是帮助其他开发者避免在这一问题上浪费时间。
尽管 SwiftData 的默认实现当前基于 Core Data,但由于 SwiftData 没有为 Model 单独声明
NSManagedObject
的子类,因此这一命名约束并不适用,开发者仍可以自由地使用new
作为属性名称的前缀。
SwiftUI 的 @Observable 宏并非 ObservableObject 的完美替代品 (SwiftUI's Observable macro is not a drop-in replacement for ObservableObject)
因其更精准的响应机制,@Observable
宏在 SwiftUI 框架中被视为 ObservableObject
的潜在替代品。然而,二者在底层实现和初始化机制上的差异导致在某些情况下表现出显著的行为差异。Jesse Squires 在本文中深入分析了这些差异如何影响应用行为,并通过实际示例揭示了在使用过程中可能遇到的问题。此外,作者还探讨了 SwiftUI 状态管理机制中存在的问题,并提出了采用更合理的架构来避免这些问题的建议,以协助开发者优化他们的 SwiftUI 应用。
SwiftData 表达式探究 (SwiftData Expressions)
SwiftData 在其初版中因缺少类似 NSExpression
的构建能力,而未能提供构建复杂谓词的功能。归功于新引入的 #Expression
宏,这一缺陷在 iOS 18 中得到了改善。在本文中,Keith Harrison 介绍了如何利用这一新 API 构建复合谓词,实现在数据库端的高效筛选。然而,尽管 #Expression
宏理论上扩展了 SwiftData 的表达能力,作者也指出在实际应用中,谓词和表达式的使用仍面临一些限制和挑战。
从 Objective-C 转换到 SwiftUI 的应用重构 (Converting an App from Obj-C)
App Store 会对长期未更新的应用程序发出警告,如在给出的最终期限前仍未更新会导致应用被下架。Sarah Reichelt 最近面临了这一挑战。她的应用原先是用 Objective-C 编写的,在本次强制更新中,Reichelt 选择了采用现代的 SwiftUI 框架进行重构。她在文章中分享了这一转换过程中遇到的技术挑战、采用的解决方案,以及她从这次经验中获得的见解和体会。
Swift Testing: 使用表现力强的 API 验证你的代码 (Swift Testing: Validate your code using expressive APIs)
Swift Testing 框架通过提供清晰且富有表现力的 API,彻底改变了 Swift 中编写测试的方式。这一框架简化了测试代码,使得开发者可以更直观地编写和管理测试。在本文中,Antoine van der Lee 介绍了这一新框架的使用方法,并展示了如何通过全局定义和 #expect
宏来简化测试断言。作者还承诺在未来几周内提供一系列深入探讨的文章,包括如何将现有的 XCTest 迁移到 Swift Testing。
内存泄漏:一部 Xcode 侦探故事 (The Memory Leak: An Xcode Detective Story)
由于内存泄漏问题,Jacob Bartlett 的应用在响应深链接(deep links)时遇到了一个 Bug,导致导航动画异常地出现两次。在这篇文章中,他详细描述了调试过程,从分析问题到确认问题源头,再到最终的解决方案。此外,他还讨论了 Swift 的内存管理机制,包括强引用、弱引用以及引用计数的工作原理。
visionOS 2 PortalComponent:更符合期待的传送神器
PortalComponent
在现实场景上创建一个视觉上的“门户”,通过这个门户,用户可以看到并与不同的虚拟环境或场景互动。在 visionOS 2 版本中,这项功能得到了进一步的增强。Puffinwalker 在本文中介绍了新增的两种模式:Clipping
和 Crossing
,这两种模式显著改善了现实延展效果,使得 Portal 内的模型能够更自然地延伸到外部世界。
Really like the quote that “innovation comes in many forms”. It’s too easy to hear people taking only one side and debating all over it nowadays. But missing what really matters: what’s behind and what we can learn from it. Always easy to follow the trend but only self critical thinking remains and grows.