Weekly Comment
Recognize the Importance of Accessibility Before It's Needed
May 16th (the third Thursday of May every year) marks this year's Global Accessibility Awareness Day (GAAD). This annual event aims to remind developers, designers, and related professionals to focus on the accessibility of their digital products and services. The event emphasizes that accessibility in technology is crucial for people with disabilities, as it enables them to use websites, applications, and various digital devices more conveniently.
One of the co-founders of GAAD, Joe Devon, articulated a vision in a 2011 article, stating: "The digital world should be open to everyone, including those with disabilities" This article inspired the initiation of the event.
Although Apple provides developers with extensive APIs to support accessibility features in apps, making an app accessible still requires significant manpower, energy, and other resources. From a purely business perspective, the return on investment for most projects is not ideal. For this reason, more companies, developers, and members of society need to fully recognize the importance of accessibility and its social value, rather than assessing its return solely from an economic standpoint.
With the emergence of new devices like Apple Vision Pro and multimodal Large Language Models, the means and prospects for implementing accessibility technologies have significantly expanded and improved.
For most developers, fully implementing accessibility in a project from the outset is undoubtedly a huge challenge. However, by adhering to a vision of accessibility and making gradual improvements, when your project serves a broader user base, you will find that all the efforts are worthwhile.
We should not wait until we face barriers to recognize the importance of accessibility. Let's take action and, through our efforts, provide convenience and opportunities for everyone.
On this year's Global Accessibility Awareness Day (GAAD), Apple announced the launch of a series of new accessibility features, further enhancing the inclusivity of its technology. These include new additions for the iPhone and iPad such as Eye Tracking, Music Haptics, and Vocal Shortcuts. Additionally, Apple has introduced innovative functionalities to its visionOS, including Live Captions and Braille Screen Input.
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
What Does spacing = nil Mean in SwiftUI?
In SwiftUI, many layout container constructors include a spacing
parameter with a default value of nil
, which controls the spacing between adjacent views. This article will start with this default parameter to explore the concept of Spacing
in SwiftUI in-depth, and share some related tips and considerations.
Recent Selections
Swift sucks at web serving… or does it?
In this article, Wade Tregaskis conducts a thorough analysis of Swift's performance in the web serving domain. Through a set of performance benchmarks, he compares web servers implemented using Swift Vapor, Node.js, PHP FPM + NGINX, and Kotlin Helidon, focusing specifically on metrics such as throughput, latency, RAM usage, and power consumption. Although initial tests showed that the Swift Vapor framework had lower throughput and a higher rate of request failures, subsequent community collaboration and technical optimization significantly improved its performance, particularly in terms of throughput and latency. These findings indicate that despite Swift's smaller market share in web serving, its performance and potential for optimization are remarkable, making it competitive with other mainstream technologies.
Debugging Animations
In SwiftUI, animations are triggered by state changes. The system creates interpolations for the changing components based on the animation functions set by developers. However, developers cannot intervene in the animation process, such as pausing at specific points. In this article (including a video), Chris Eidhof and Florian Kugler explore how to precisely control the animation process using the CustomAnimation feature introduced at WWDC 2023. By integrating this functionality into a view modifier and coupling it with slider input to update the animation, they make the debugging process more intuitive and effective.
@LiveModel in SwiftData
SwiftData leverages Swift's modern concurrency model to provide developers with an elegant, secure, and efficient way to handle data. However, many developers have noticed that when data updates occur in a non-main context, even though the data is successfully updated in the background, the changes are not always promptly reflected in the views. To address this issue, Pat has proposed a solution called the @LiveModel
property wrapper. This wrapper ensures that data changes made in any context are immediately reflected in the UI, effectively resolving synchronization issues between data and views.
Reducing iOS Test execution time with Selective Testing
In this article, Tuan Hoang (Eric) discusses the importance of automated testing in ensuring project quality and the issues with increased execution time as the number of tests grows. For example, Eric encountered a problem at his previous company where running over 3,000 unit tests required approximately 420 minutes each day. To address this issue, he proposed a "selective testing" strategy. This method involves analyzing the modules affected by code changes and running tests only on those modules, significantly reducing test execution time. Selective testing is implemented through five steps: generating a module dependency graph, computing module hashes, using cached hashes for comparison, updating the test plan, and updating the cache. This approach not only improves testing efficiency but also reduces the burden on continuous integration systems.
Backend APIs: Constant evolution but tethered to the past
In modern application development, rapid deployment and continuous iteration are the norm. When mobile apps rely on backend services, the management of backend APIs becomes particularly crucial. In this article, Thomas Durand explores how to ensure backward compatibility of APIs while introducing new features, outlining a series of strategies such as version control and backward-compatible changes to ensure smooth transitions across different versions of applications and minimize user disruption. The article emphasizes that compared to regular application development, API management requires more meticulous planning and enhanced testing, which are critical for maintaining stable operation of the apps and user satisfaction.
The examples and tests mentioned in the article are based on the Vapor framework, demonstrating how to manage the gradual evolution of APIs without sacrificing the functionality of older app versions.
Craftsmanship & Consideration
Since 2009, David Smith has attended every WWDC, making it a significant part of his annual work routine. In this article, David shares his anticipation for the upcoming 2024 WWDC and his deep reflections on his years of participation in this event. He emphasizes that his excitement for WWDC stems not just from the event itself, but also from the opportunity to connect with a community that shares a commitment to craftsmanship and thoughtful consideration. David elaborates on the core values of this community—craftsmanship and consideration—and expresses his desire to continuously learn and grow through interactions with such a community.
肘子的话
不要等到遇到障碍时才意识到无障碍的重要性
5 月 16 日(每年五月的第三个星期四)是今年的全球无障碍意识日(GAAD)。这个年度活动旨在提醒开发者、设计师及相关从业人员关注其数字产品和服务的无障碍性。活动强调,对残障人士而言,技术的无障碍性至关重要,无障碍设计可以帮助他们更便利地使用网站、应用程序和各种数字设备。
全球无障碍意识日的共同创始人之一,Joe Devon,在 2011 年发表的一篇文章中阐述了一个理念:“数字世界应该向所有人开放,包括那些有残障的人。”这篇文章成为了该活动的发起灵感。
尽管苹果为开发者提供了丰富的 API 来支持应用的无障碍功能开发,但要为应用提供无障碍适配仍需耗费大量人力、精力及其他资源。从纯商业的角度来看,对于多数项目来说其投入产出比也并不理想。正因如此,更多的公司、开发者和社会人士需要充分认识到无障碍的重要性及其社会价值,而不应仅从经济效益的角度评估其回报。
随着 Apple Vision Pro 等新型设备以及多模态 LLM 的不断涌现,无障碍技术的实现手段和前景都得到了显著扩展和提升。
对多数开发者而言,一次性完全实现项目的无障碍化无疑是一个巨大的挑战。但只要坚持无障碍愿景,逐步改进,当你的项目能服务于更广泛的用户群体时,你会发现所有的努力都是值得的。
我们不应该等到遇到障碍时才认识到无障碍的重要性。行动起来,通过我们的努力为每一个人提供便利和机会。
在今年的全球无障碍意识日(GAAD),苹果公司宣布推出一系列 新的辅助功能,这些功能进一步扩展了其技术的包容性。这包括了为 iPhone 和 iPad 新增的眼动追踪(Eye Tracking)、音乐触觉(Music Haptics)和人声快捷键(Vocal Shortcuts)。此外,苹果还为 visionOS 引入了实时字幕(Live Captions)和盲文屏幕输入(Braille Screen Input)等创新功能。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。
原创
在 SwiftUI 中,spacing = nil 表示什么?
在 SwiftUI 中,许多布局容器的构造函数都包含一个默认值为 nil
的 spacing
参数,该参数负责控制临近视图之间的间隙。本文将从这一默认参数出发,深入探讨 SwiftUI 中的 Spacing
概念,并分享一些相关的技巧及注意事项。
近期推荐
Swift sucks at web serving… or does it? ( Swift在Web服务上表现糟糕……真的吗? )
Wade Tregaskis 在这篇文章中深入分析了 Swift 在 web 服务领域的性能。通过一项性能基准测试,他比较了 Swift Vapor、Node. js、PHP FPM + NGINX 和 Kotlin Helidon 等技术实现的 web 服务器在处理负载时的表现,特别关注了吞吐量、延迟、RAM 使用和电力消耗等指标。虽然初次测试显示 Swift 的 Vapor 框架在吞吐量上较低,请求失败率较高,但经过社区合作和技术调优后,Vapor 显著改善了性能,特别是在吞吐量和延迟方面。这些发现表明,尽管 Swift 在 Web 服务器市场的占比不大,但其性能和优化潜力令人瞩目,足以与其他主流技术相匹敌。
Debugging Animations ( 调试 SwiftUI 动画 )
在 SwiftUI 中,动画由状态变化触发。系统根据开发者设置的动画函数,为变化的组件创建状态插值。然而,开发者无法在动画过程中进行干预,比如在特定位置暂停动画。在本文(附视频)中, Chris Eidhof 和 Florian Kugler 介绍了如何利用 WWDC 2023 推出的 CustomAnimation 功能来精确控制动画进程。他们通过将此功能集成到视图修饰符中,并结合滑块输入来更新动画,从而使动画调试过程更为直观和有效。
@LiveModel in SwiftData
SwiftData 利用 Swift 的现代并发模型,为开发者提供了一种优雅、安全、高效的数据处理方式。然而,许多开发者已经注意到,在非主上下文中进行数据更新时,尽管数据在后台已成功更新,视图中的数据却常常无法及时反映这些变化。为应对此问题,Pat 提出了一种名为 @LiveModel
的属性包装器解决方案。该包装器能确保无论在哪个上下文中进行的数据变更,都能够即时地反映到 UI 上,从而有效解决了数据和视图之间的同步问题。
Reducing iOS Test execution time with Selective Testing ( 通过选择性测试减少 iOS 测试执行时间 )
在这篇文章中,Tuan Hoang(Eric)探讨了自动化测试在保证项目质量中的重要性及其随着测试数量增加导致的执行时间问题。例如,Eric 曾在他前公司的项目中遇到一个问题:超过 3000 个单元测试每天需要花费大约 420 分钟来运行。为了解决这个问题,他提出了一个“选择性测试”方案。这种方法通过分析代码变更影响的模块,并只对这些模块执行测试,显著减少了测试执行时间。选择性测试通过生成模块依赖图、计算模块哈希、利用缓存哈希比对、更新测试计划以及缓存更新五个步骤实现。此方案不仅提高了测试效率,也减轻了持续集成系统的负担。
Backend APIs: Constant evolution but tethered to the past ( 后端APIs:持续演进与历史羁绊 )
在现代应用开发中,快速上线和持续迭代是常态。当移动应用依赖后端服务时,后端 API 的管理就显得尤为重要。Thomas Durand 在本文中探讨了如何在引入新功能的同时确保 API 的向后兼容性,阐述了一系列策略如版本控制和向后兼容的变更,确保不同版本的应用能平滑过渡并减少用户干扰。文章强调,与常规应用开发相比,API 管理需要更加精细的规划和强化的测试,这对于保持应用的稳定运行和用户满意度至关重要。
文章中提到的示例和测试都基于 Vapor 框架进行说明,展现了如何处理 API 的逐步演化而不牺牲旧版本应用的功能性。
Craftsmanship & Consideration ( 工匠精神与深思熟虑 )
自 2009 年起,David Smith 已连续参加了所有的 WWDC,这已成为他年度工作的重要组成部分。在这篇文章中,David 分享了他对即将到来的 2024 年 WWDC 的期待,以及他对多年来参与这一活动的深刻反思。他强调,对 WWDC 的兴奋不仅仅因为活动本身,更因为能够与一群共享工匠精神和深思熟虑价值观的人相聚。David 阐述了这个社区的核心价值观——工匠精神(Craftsmanship)和深思熟虑(Consideration),并表达了通过与这样的社区互动,不断学习和成长的渴望。