Fatbobman's Swift Weekly #071
Building Android Apps with SwiftRecently, the Swift community established the Swift on Android Community Workgroup, aiming to promote the use of Swift in the Android ecosystem. This initiative follows a similar path to how the Arc browser advanced Swift's development on the Windows platform. Notably, members of the Skip team, which specializes in cross-platform development, have also joined the working group. Although still in its early stages, this undoubtedly marks an important step for the Swift community in breaking down platform barriers. For developers deeply entrenched in the Apple ecosystem, the possibility of using the familiar Swift language to develop Android applications is an exciting prospect. However, the path to cross-platform development is far from smooth. Much of Swift's infrastructure, from official frameworks to numerous third-party libraries, is tightly intertwined with Apple's platforms. To achieve true cross-platform development, the community needs to build a comprehensive set of platform-agnostic APIs, which remains a significant challenge for most developers. Fortunately, the open-source community is contributing to Swift's cross-platform journey. The OpenSwiftUI project recently released the implementation of ViewList, a critical component for understanding the private APIs of SwiftUI's View protocol. Combined with the progress of OpenGraph, the development pace of OpenSwiftUI is expected to accelerate, and a version supporting basic view functionality could be available to developers within the next few months. Meanwhile, the Point-Free team's Sharing GRDB project offers a fresh approach to cross-platform data persistence. Despite Swift's impressive potential in the cross-platform space, the challenges ahead cannot be overlooked. Beyond technical hurdles, nurturing the community ecosystem and refining the development toolchain are equally crucial. For Swift to truly break free from the Apple ecosystem, it will require not only the community's relentless efforts but also the active participation of developers at large. I also hope that Apple will open up more of its official Swift frameworks. Swift's success on other platforms will not undermine the Apple ecosystem; on the contrary, such openness could attract more developers to embrace Apple's platform. The vitality of technology lies in its openness and universality. A more open Swift will not only advance cross-platform development but also bring more innovation and possibilities to the entire developer community. Let Swift evolve from being "Apple's language" to becoming "the world's language" as soon as possible. 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! OriginalMastering SwiftUI Scrolling: Implementing Custom PagingSince iOS 17, SwiftUI introduced Recent RecommendationsExploring MLX Swift: Getting Started with Tool UseLLMs can surpass their training data limitations by calling external tools (Tool Use) to access real-time information and execute tasks. Swift developers can now achieve this capability with MLX Swift. In this article, Rudrank Riyam introduces how to use tool calling in MLX Swift, demonstrating a real-time weather query example—from defining tools, parsing LLM calls, fetching weather data, to applying the retrieved information. The corresponding code is available in the MLX-Outil project. Configuring Deep Links in SwiftUIDeep Links allow users to navigate directly to a specific page or feature within an app rather than just opening the home screen. In this article, Fang Junyu provides a detailed guide on configuring URL Scheme and Universal Link, as well as handling deep link events in SwiftUI. The article explores multiple approaches for deep link event propagation, including Swift Localization in 2025: Best Practices You Couldn’t Use BeforeWhile String Catalogs have significantly improved localization efficiency in Xcode projects, using English text as keys enhances readability but introduces issues such as lack of grouping, unclear context, and inconsistent translations. In this article, Cihat Gündüz introduces TranslateKit, an open-source Swift SDK designed to address these challenges. It offers automatic semantic key generation ( What is a Configuration (.xcconfig) File in Xcode?
Swift Interoperability with CSwift can seamlessly interoperate with C code, allowing developers to call C-written libraries within Swift projects. In this article, Mirza Učanbarlić demonstrates how to create a simple C library and use it in Swift, covering compiling C code, generating static libraries, creating Clang modules ( 用 Swift 来构建安卓应用近日,Swift 社区成立了 Swift on Android Community Workgroup,旨在推动 Swift 在 Android 生态中的应用。这一举措与 Arc 浏览器推动 Swift 在 Windows 平台发展的路径类似,专注于跨平台开发的 Skip 团队也有成员加入了该工作组。虽然目前还处于起步阶段,但这无疑标志着 Swift 社区正在为打破平台界限迈出重要一步。 对于深耕苹果生态的开发者而言,使用熟悉的 Swift 语言开发 Android 应用是一个令人期待的可能性。不过,跨平台开发的道路并不平坦。Swift 生态中的大量基础设施,从官方框架到众多第三方库,都与苹果平台有着千丝万缕的联系。若要实现真正的跨平台开发,社区需要构建起一整套与平台无关的 API 体系,这对普通开发者来说仍是一个不小的挑战。 令人欣喜的是,开源社区正在为 Swift 的跨平台之路贡献力量。OpenSwiftUI 项目最近公开了 ViewList 相关的代码实现,这是理解 SwiftUI 中 View 协议未公开 API 的关键部分。结合 OpenGraph 的实现进度,OpenSwiftUI 的开发节奏有望加快,一个支持基础视图功能的版本有不小的希望会在未来几个月内与开发者见面。与此同时,Point-Free 团队推出的 Sharing GRDB 项目为跨平台数据持久化提供了全新思路。 尽管 Swift 在跨平台领域展现出了令人瞩目的潜力,但前方的挑战依然不容忽视。除了技术层面的障碍,社区生态的培育和开发工具链的完善同样重要。Swift 能否真正突破苹果生态,不仅需要社区持续不断的努力,更需要广大开发者的积极参与。 我同样期待苹果能够进一步开放其部分官方 Swift 框架。Swift 在其他平台上的成功不会动摇苹果生态的根基,相反,这种开放姿态可能会吸引更多开发者投入苹果平台的怀抱。 技术的生命力在于其开放性和普适性。一个更开放的 Swift,不仅能够推动跨平台开发的进步,还能为整个开发者社区带来更多创新和可能性。让 Swift 从“苹果的语言”尽快蜕变为“世界的语言”。 如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 爱发电,Buy Me a Coffee 支持我的创作。 原创精确掌控 SwiftUI 滚动:自定义 Paging 实现SwiftUI 从 iOS 17 开始引入 近期推荐探索 MLX Swift:工具调用 (Exploring MLX Swift: Getting Started with Tool Use)LLM 通过调用外部工具(Tool Use)可以突破仅依赖训练数据的局限,实现实时信息获取和任务执行。Swift 开发者现在可以通过 MLX Swift 实现这一能力。Rudrank Riyam 在本文中介绍了如何在 MLX Swift 中使用工具调用,并以实时天气查询为例,演示了从定义工具、解析 LLM 调用、获取天气数据到应用数据的完整流程。相关代码可在 MLX-Outil 项目 中查看。 SwiftUI 配置深层链接Deep Link(深层链接)允许用户直接跳转到应用内的特定页面或功能,而不仅仅是打开首页。在这篇文章中,方君宇详细介绍了 URL Scheme 和 Universal Link 的配置方法,并探讨了如何在 SwiftUI 中处理深层链接事件。文章提供了多种深层链接传递方案,包括 用 TranslateKit 实现本地化 (Swift Localization in 2025: Best Practices You Couldn’t Use Before)尽管 String Catalogs 大幅改善了 Xcode 项目的本地化效率,但其以英文文本作为键的方式,虽然提升了可读性,却带来了缺乏分组、上下文不清、翻译一致性差等问题。Cihat Gündüz 在这篇文章中介绍了 TranslateKit,一个旨在解决这些问题的开源 Swift SDK。它提供了自动语义键生成( 🪜 xcconfig 文件解析 (What is a Configuration (.xcconfig) File in Xcode?)
Swift 与 C 互操作 (Swift Interoperability with C)Swift 可以与 C 代码进行无缝互操作,从而让开发者在 Swift 项目中调用 C 语言编写的库。在这篇文章中,Mirza Učanbarlić 演示了如何创建一个简单的 C 库并在 Swift 中使用它,涉及编译 C 代码、生成静态库、创建 Clang 模块 ( Let's Vision 2025LET’S VISION 是中国最大、最具国际化的 Apple 生态盛会,被誉为 Apple 生态中的“超级盛典”。本届大会将在 2025 年 3 月 1 日 —— 3 月 2 日 在 上海鲜花港 举办,主题为:人工智能 + 空间计算 = 无限♾️ 。活动将带领你走在 Apple 生态的最前沿,展示最创新、最尖端的产品与技术。无论你是开发者、创业者,还是行业精英,这将是你不可错过的年度盛会! 请访问 Let's Vision 大会官网 了解更多活动详情和嘉宾名单。学生可以享受半价购票优惠。点击此处 可九折购买门票。
Welcome to my blog Fatbobman's Swift Blog( 肘子的Swift记事本 ) |