Weekly Comment
Ensure "Driverless Cars" Don't Lead to "Jobless Masses"
Recently, Baidu (China's largest search engine company)'s stock price has risen significantly, which is not unrelated to a widely circulated news story. Reportedly, Baidu's autonomous ride-hailing platform "Apollo Go" deployed 1,000 self-driving taxis in Wuhan, achieving impressive market performance and triggering deep concern among some traditional taxi drivers.
Soon, the news was proven to be inaccurate. The actual operational scale is 400 vehicles, and in Wuhan's market of nearly 20,000 taxis, this scale is not yet sufficient to cause a significant impact. Nevertheless, self-driving taxis have won favor with many consumers due to their more competitive prices, brand-new vehicle conditions, and better privacy experience. As the deployment scale expands, its impact on the existing market and numerous taxi (ride-hailing) practitioners will be inevitable and irreversible.
Like previous industrial revolutions, the rapid development of AI will inevitably impact many industries, even causing disruption. In this AI era, while enjoying its conveniences, each of us will face the challenges it brings. Facing this unavoidable structural change, relying solely on market self-regulation may not be enough to address the destructive impact of AI on traditional industries and the employment environment. This requires the concerted efforts of the whole society and government, adopting methods that conform to development laws to alleviate the more severe challenges we currently face and will face.
While encouraging AI development, governments should innovatively formulate laws and policies, utilizing special taxation, fiscal subsidies, and other measures to assist industries and workers significantly impacted by AI in achieving transformation or re-employment. Various indications suggest that AI may not elevate the upper limits of human technology in the short term; however, its impact on labor-intensive industries is both rapid and profound.
Of course, specifically in the taxi service industry, there is an inevitable cost difference between human-driven and driverless operational models. If the human element cannot become an added value to the service, and instead negatively impacts the passenger experience, then replacement by driverless or other innovative operational models becomes a natural progression.
However, it is worth noting that these AI companies, often possessing Internet business DNA, tend to adopt low-price strategies regardless of cost. They may first conduct a "cleansing" of the existing industry, and then use their established market advantage to rebuild price monopolies. This approach not only potentially causes irreversible damage to society but also deviates from the original intention of AI serving society. We must guard against such business behaviors that may lead to market imbalance to ensure that the development of AI technology truly benefits society.
The ultimate goal of AI should be to promote better human development and improve overall quality of life, rather than benefiting only a few companies and individuals. At the same time, we must acknowledge that for industries and individuals who struggle to adapt quickly to the new era, being affected or even replaced by new things, though regrettable, is an unavoidable reality in social development.
In this era of change, we must embrace innovation while focusing on social equity; pursue efficiency while maintaining humanitarian care. Let AI become a tool to help humanity, not a force that disrupts social balance.
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
List or LazyVStack: Choosing the Right Lazy Container in SwiftUI
In the world of SwiftUI, List
and LazyVStack
, as two core lazy containers, offer robust support for developers to display large amounts of data. However, their similar performance in certain scenarios often causes confusion among developers when making a choice. This article aims to analyze the characteristics and advantages of these two components to help you make a better decision.
Recent Selections
SwiftUI Pitfalls: My Failures and Lessons Learned
In this article, gloomikon shares his experiences and lessons learned while implementing a chat interface tooltip using SwiftUI. The author provides a step-by-step guide, detailing various challenges encountered during the development process and their solutions. These include using overlay
to display the tooltip, correctly positioning the tooltip, resolving view obstruction issues, implementing show/hide functionality, and adding animation effects. gloomikon demonstrates how to utilize various SwiftUI features (such as fixedSize
, alignmentGuide
, zIndex
, scaleEffect
, etc.) to handle complex layout and interaction requirements. The article offers readers practical SwiftUI development insights and approaches to solving common pitfalls, making it a valuable resource for developers working with SwiftUI.
Just Toolbox Unifying Development with SwiftUI
In this article, Justin Yan shares his comprehensive experience of developing and releasing a developer toolbox application that spans across all Apple platforms using SwiftUI. The article explores the multiple advantages and challenges of developing with SwiftUI, covering topics such as cross-platform code sharing, API maturity, and the shift in UI design thinking—particularly how to move away from traditional UIKit and AppKit design mindsets to fully leverage SwiftUI's cross-platform capabilities. Justin also discusses the unique advantages of using SwiftUI as an independent developer and shares how he overcame psychological barriers during the development process. This article provides insightful perspectives and experiences for developers looking to transition from other frameworks to SwiftUI, making it an invaluable resource for those exploring cross-platform development within the Apple ecosystem.
Introducing Entry macro in SwiftUI
In SwiftUI development, customizing environment values and focus values typically involves repetitive and cumbersome code. At WWDC 2024, Apple introduced the @Entry
macro, a new feature that significantly simplifies this process. In this article, Majid Jabrayilov provides a detailed guide on how to use the @Entry
macro and emphasizes its backward compatibility, allowing developers to utilize this macro on older versions of Apple platforms. This macro not only optimizes code writing but also enhances development efficiency, offering SwiftUI developers a more concise programming approach.
The emergence of Swift macros represents a substantial improvement for such scenarios, serving as a wake-up call for more Swift developers to design APIs using more unified paradigms and benefit from these new features. This goes beyond mere code simplification; it's a push towards modern programming practices, encouraging developers to explore and adopt new programming patterns for more efficient problem-solving. This advancement not only streamlines the coding process but also promotes a shift in how developers approach API design and problem-solving in the Swift ecosystem.
Techniques for Automatic Merging of String Catalogs in Multi-Package Monorepos
In a multi-package monorepo, where each package has its own independent String Catalog, developers typically need to merge these catalogs manually or using tools. In this article, Luca Ban introduces a method that automatically merges these catalogs during the main app's build process, without requiring additional scripts or manual intervention. This approach is achieved through appropriate code setup and Swift package configuration. It can significantly simplify the localization management process for large projects, especially those with multiple packages or modules. This centralized management approach can improve efficiency, reduce errors, and ensure localization quality across the entire application while maintaining the flexibility for each package to manage its localization resources independently.
Mobile Deployment Pipelines for $0
Jacob Bartlett's article provides a valuable guide for iOS developers looking to implement free continuous integration (CI). The article offers a detailed walkthrough on how to build a CI pipeline for mobile applications using Fastlane and GitHub Actions, covering key steps from basic Fastlane setup to App Store Connect configuration. The author emphasizes the importance of using match for certificate management and provides methods for creating API keys to achieve automated deployment. This resource not only helps developers enhance their development practices and streamline deployment processes, but also demonstrates how to implement professional-grade CI workflows without incurring additional costs. It is particularly valuable for independent developers and small project teams, offering a cost-effective solution for improving their development and deployment processes.
UI testing improvements in Xcode 16
At WWDC 2024, Apple not only introduced Swift Testing but also enhanced the UI testing capabilities of the XCTest framework. Jesse Squires provides a detailed introduction to two new APIs: waitForNonExistence(withTimeout:)
and wait(for:toEqual:timeout:)
. The former offers an inverse functionality for waiting for elements to disappear, while the latter is used for waiting for element property values to update. Through practical code examples, the author demonstrates how these APIs improve the semantics and efficiency of testing, especially when dealing with loading states and content update scenarios. Squires also points out some naming inconsistencies and potential bugs, offering developers valuable insights. Although these improvements may seem minor, they significantly enhance the readability and flexibility of UI testing, providing iOS developers with more powerful testing tools.
肘子的话
不要让“无人驾驶”发展成“无人就业”
近期,百度股价显著上涨,这与一则广为流传的消息不无关联。据传,百度旗下自动驾驶出行平台"萝卜快跑" (Apollo Go)在武汉投入了 1000 辆无人驾驶出租车,市场表现亮眼,引发了部分传统出租车司机的强烈担忧。
很快,消息被证明为不准确。实际运营规模为 400 辆,且在拥有近 2 万辆出租车的武汉市场中,这一规模尚不足以造成显著冲击。尽管如此,无人驾驶出租车凭借更具竞争力的价格、崭新的车况以及更佳的隐私体验,已赢得不少消费者青睐。随着投放规模的扩大,其对现有市场及大量出租车 (网约车)从业者的影响将不可避免且难以逆转。
正如历次工业革命, AI 的迅猛发展必将对诸多行业产生冲击,甚至引发颠覆。在这个 AI 时代,我们每个人都将在享受其便利的同时,面对其带来的挑战。面对这场不可避免的结构性变革,仅依赖市场的自我调节恐难以应对 AI 对传统产业和就业环境的破坏性影响。这需要全社会和政府的协同努力,采取符合发展规律的方式来缓解当前及即将面临的更为严峻的挑战。
政府在鼓励 AI 发展的同时,应创新性地制定法律和政策,通过特别税收、财政补贴等形式,助力受 AI 影响较大的产业和从业者实现转型或再就业。种种迹象表明, AI 或许不会在短期内提升人类科技的上限,但其对就业密集型产业的冲击却是迅猛而深远的。
当然,仅就出租车这一特定服务行业而言,人工驾驶与无人驾驶的经营模式在成本上必然存在差距。如果"人"这一要素不能成为服务的加分项,反而影响了乘客的体验,那么被无人驾驶或其他创新运营模式取代也就顺理成章了。
但值得警惕的是,当前这些具备互联网商业基因的 AI 公司,往往采用不计成本的低价策略。他们可能先对固有行业进行一次"清洗",而后利用已形成的市场优势重新构建价格垄断。这种做法不仅可能对社会造成不可挽回的损失,还偏离了 AI 服务于社会的初衷。我们必须提防这种可能导致市场失衡的商业行为,以确保 AI 技术的发展真正造福社会。
AI 的终极目标应是促进人类更好地发展,提升整体生活质量,而非仅仅使少数公司和个人受益。同时,我们也必须承认,对于难以快速适应新时代的产业和个人而言,被新事物影响甚至取代,虽然令人遗憾,却是社会发展中不可回避的现实。
在这个变革的时代,我们既要拥抱创新,也要关注社会公平;既要追求效率,也要维护人文关怀。让 AI 成为帮助人类的工具,而不是破坏社会平衡的力量。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
List 还是 LazyVStack:SwiftUI 中的惰性容器选择
在 SwiftUI 的世界里,List
和 LazyVStack
作为两大核心惰性容器,为开发者展示大量数据提供了强大的支持。然而,它们在某些场景下表现相似,常常让开发者在选择时感到困惑。本文旨在剖析这两个组件的特点、优势,以帮助你更好地作出选择。
近期推荐
SwiftUI 陷阱:我的失败与经验教训🪜 ( SwiftUI Pitfalls: My Failures and Lessons Learned )
gloomikon 在这篇文章中分享了他使用 SwiftUI 实现聊天界面帮助提示工具(tooltip)时的经历和教训。文章通过逐步实现的方式,详细说明了在开发过程中遇到的各种问题及其解决方案,包括使用 overlay
显示 tooltip、正确定位 tooltip、解决视图遮挡问题、实现显示/隐藏功能、添加动画效果等。作者展示了如何运用 SwiftUI 的各种特性(如 fixedSize
、alignmentGuide
、zIndex
、scaleEffec
等)来处理复杂的布局和交互需求,为读者提供了实用的 SwiftUI 开发经验和常见陷阱的解决思路。
Just Toolbox: 使用SwiftUI一统天下
在这篇文章中,作者 Justin Yan 分享了他利用 SwiftUI 开发并发布一款覆盖苹果全平台的开发者工具箱应用的全过程。文章探讨了使用 SwiftUI 进行开发的多重优势与所面临的挑战,涵盖了跨平台代码共享、API 的成熟度、以及 UI 设计思路的转变——尤其是如何从传统的 UIKit 和 AppKit 设计思维中脱离,以充分利用 SwiftUI 的跨平台特性。Justin 同样讨论了作为独立开发者使用 SwiftUI 的独特优势,并分享了他如何在开发过程中克服心理障碍。这篇文章对于那些希望从其他框架转向 SwiftUI 的开发者而言,提供了具有启发性的见解和经验。
SwiftUI 中的 Entry 宏介绍 ( Introducing Entry macro in SwiftUI )
在 SwiftUI 开发中,自定义环境值和焦点值通常涉及重复且繁琐的代码。在 WWDC 2024 中,苹果介绍了 @Entry
宏,这一新特性极大简化了这一操作。Majid Jabrayilov 在本文中详细介绍了 @Entry
宏的使用方法,并强调了它的向后兼容性,使得开发者能在较旧版本的 Apple 平台上使用这一宏。这一宏不仅优化了代码的书写,还提升了开发效率,为使用 SwiftUI 的开发者提供了一种更简洁的编程方式。
Swift 宏的出现对于这类场景有巨大的提升,这也给更多的 Swift 开发者提了个醒,用更加统一的范式来设计 API,并从这些新功能中受益。这不仅是代码层面的简化,更是对现代编程实践的一种推动,鼓励开发者探索和采纳新的编程模式,以更高效地解决问题。
多包单库中的 String Catalog 自动合并技巧
在一个多包(multi-package)的单一代码库(monorepo)中,如果每个包有自己独立的 String Catalog,开发者通常需要手动或使用工具来将它们进行合并。在本文中,Luca Ban 介绍了一种方法,可以在构建主应用时自动实现合并过程,无需额外的脚本或手动操作。这种方法通过适当的代码设置和 Swift 包配置来实现自动合并。它可以显著简化大型项目的本地化管理过程,特别是对于那些有多个包或模块的项目。这种集中化的管理方式可以提高效率,减少错误,并确保整个应用的本地化质量,同时保持了每个包独立管理本地化资源的灵活性。
零成本移动应用部署流水线🪜 ( Mobile Deployment Pipelines for $0 )
Jacob Bartlett 的这篇文章为希望实现免费持续集成(CI)的 iOS 开发者提供了宝贵指南。文章详细介绍了如何使用 Fastlane 和 GitHub Actions 构建移动应用的 CI 流程,涵盖了从 Fastlane 的基本设置到 App Store Connect 的配置等关键步骤。作者特别强调了使用 match 进行证书管理的重要性,并提供了创建 API 密钥实现自动化部署的方法。这篇资源不仅帮助开发者增强开发实践、简化部署流程,还展示了如何在不增加成本的情况下实现专业级的 CI 流程,对独立开发者和小型项目团队尤其有价值。
Xcode 16 中的 UI 测试改进 ( UI testing improvements in Xcode 16 )
在 WWDC 2024 中,苹果不仅推出了 Swift Testing,还增强了 XCTest 框架的 UI 测试能力。jesse squires 详细介绍了两个新的 API:waitForNonExistence(withTimeout:)
和 wait(for:toEqual:timeout:)
。前者提供了等待元素消失的反向功能,后者用于等待元素属性值更新。通过实际代码示例,作者展示了这些 API 如何提高测试的语义化和效率,特别是在处理加载状态和内容更新场景时。squires 还指出了一些命名不一致和潜在的 bug,为开发者提供了实用的见解。这些改进虽小,但对提高 UI 测试的可读性和灵活性具有重要意义,为 iOS 开发者提供了更强大的测试工具。
活动
报名参加 WWDC24 Office Hour
活动时间:2024 年 7 月 23 日 上午 10:00 – 下午 4:00 (GMT+8)
与 Apple 专家交流( 30 分钟线上咨询 ),了解如何利用 WWDC24 上公布的重大更新。这项活动采用在线预约形式,你可以从中获得关于最新框架和技术、开发者工具、设计、技术实施等方面的建议。活动语言为普通话。
请在 7 月 16 日晚上 11:45 (GMT+8) 之前提交申请。
探索 SwiftUI 尺寸的秘密
我将在 7 月 17 日上午 10 点,在杭州的湖畔研创中心参与 AdventureX,聊聊 SwiftUI 中与尺寸有关的一些内容。workshop 面向所有公众免费开放。在杭州的朋友有兴趣的可以来一起交流一下。