中文位于文章的下半部分
Weekly Comment
Last week, Tony Stubblebine, the CEO of Medium, published an article titled Let a thousand programming publications bloom on Medium. In the article, he announced the temporary suspension of the highly acclaimed publication, Better Programming, in order to make room for other programming publications, as the title suggests.
Better Programming is popular on Medium and is one of the most subscribed technology publications. Some of the articles I have published on Medium have been accepted and recommended to more readers through Better Programming. However, as the IT field continues to specialize, Better Programming's readers are receiving many excellent articles that are not directly relevant to their interests. This not only disperses the readers' attention but also hinders the formation of closer connections between readers and authors.
Stubblebine points out that Medium is going through some changes and believes that these changes will ultimately benefit authors, readers, and publications. He mentions that Medium has always had publications similar to group blog and a sub-reddit that help set quality standards and provide feedback on articles. He encourages some readers to create their own publications and provides some guiding principles for doing so. For authors, this means there will be more publications available for submission on Medium.
After the closure of Better Programming, Michael Long told me that he created a new publication focused on Swift and SwiftUI called The Swift Cooperative. Therefore, last week I published an article about ViewThatFits in this new publication.
As a Chinese blogger, my initial purpose of publishing English versions of my articles was simple: to test whether my sharing of Swift and SwiftUI in the Chinese world is equally valuable in the English world (or a larger readership). In order to make my articles accessible from the beginning, I chose the Medium platform, which has the potential to attract readers without the need for promotion. Starting from April this year, I gradually translated and published articles that were previously published on my Chinese blog on Medium. With the help of publications such as Better Programming and ITNEXT, this week I reached a milestone of over a thousand followers on Medium. The increasing number of readers and views has given me more motivation and allowed me to meet many new friends.
Currently, I am restructuring my Chinese blog. Starting from 2024, I will be publishing bilingual versions of my articles on it ( I will continue to sync updates on Medium until April 2024 ). In the next blog post, I will share some insights on paired programming with AI that I gained during the recent blog restructuring.
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
Mastering ViewThatFits
In iOS 16, SwiftUI introduces a new adaptive layout container called ViewThatFits. As the name suggests, its purpose is to find the most appropriate view among a given set of views and use it. For most people, this is a simple and easy-to-use container. However, this article intends to thoroughly analyze it, including rule details, the meaning of ideal size, usage examples, and more. Lastly, we will create a replica version of ViewThatFits to deepen our understanding of it.
Recent Selections
Introducing Inferno: Metal shaders for SwiftUI
At WWDC 2023, Apple added several new modifiers to SwiftUI. With these modifiers, developers can easily apply Metal Shaders to views. However, in practical applications, we find that although it is convenient to use, most developers do not have the knowledge to write shaders, and the available resources and materials for reference are relatively limited.
To improve this situation, Paul Hudson created the Inferno project, an open-source collection of fragment shaders. Now, even without experience in writing shaders, we can easily apply shaders to our own applications. With this project, Paul also provides two videos: one is an introduction video, and the other is about creating custom shaders. Additionally, he has developed a new Shader course specifically for subscribers of HackingWithSwift.
Debugging SwiftUI views: what caused that change?
Almost all developers using SwiftUI will encounter a problem where the frequent redraw of views due to multiple triggers leads to decreased application performance, abnormal animations, and difficulties in troubleshooting. In this article, Antoine van der Lee not only reveals the nature of this problem but also provides clear examples and solutions to help you avoid falling into the trap of "Massive SwiftUI Views." Whether you are a beginner or an experienced developer in SwiftUI, this article can bring new perspectives and skills to your development work.
Macro Bonanza
The macros in Swift have received widespread acclaim since their introduction. Point-Free has also applied them to their four popular libraries: CasePaths, ComposableArchitecture, SwiftUINavigation, and Dependencies. In this article, the author demonstrates how Swift macros greatly simplify and enhance the capabilities of these libraries, including: simplifying code structure, improving the intuitiveness and usability of APIs, enhancing functionality and flexibility, and improving testing and debugging. Although these libraries originated from The Composable Architecture (TCA), they are also applicable to applications using other architectures. Even if you don't use TCA, these libraries will be of great help in your development.
Questions about the data to create LLMs for embeddings
In this article, Joseph Heck discusses the data sources and performance issues of large language models (LLMs). He first expresses concerns about the data sources used to train these large language models, which has made him hesitant to apply the results to open-source projects due to a lack of confidence in the sources. He also shares his views on the relationship between model size and performance, as well as the challenges of data management and model updates. Lastly, Heck expresses his desire to find LLMs based on "clean data sources," acknowledging that the collection and organization of multilingual data is a more demanding task than utilizing the data itself, requiring resources from academic institutions, companies, and even society as a whole.
The issue of the legitimacy of LLM data sources has long remained unresolved and unconfirmed. With the sudden removal of OpenAI CEO Sam Altman, this issue will once again receive attention from society.
ObservationBP
In the #002 weekly, we introduced the ObservationBP project created by onevact. This project brings the capabilities of the Observation framework to lower versions of SwiftUI. However, in the current implementation, developers need to explicitly wrap each view that accesses properties of an Observable instance.If the view contains other Lazy views, a second wrapping is also required, which increases the burden on the user. Building on onevact's work, winddpan has made adjustments, and now developers can use the ObservationBP library in lower versions of SwiftUI in a way that is close to native Observation (just by adjusting or adding a property wrapper).
肘子的话
上周,Tony Stubblebine( Medium 的 CEO )在 Medium 发表了一篇文章 Let a thousand programming publications bloom,在文章中他宣布将广受好评的 Better Programming 出版物暂时搁置,以便为其他编程出版物腾出空间,正如该文的标题所表示的那样:让更多的出版物百花齐放。
Better Programming 在 Medium 很受欢迎,是订阅量最高的几个科技读物之一。我发表在 Medium 上的文章也有一部分被其采纳,并推荐给了更多的读者。但是随着 IT 领域的不断细分,Better Programming 的读者每天将收到不少优秀但与其关联性不高的文章。即分散了读者的精力,也不利于读者与作者之间形成更紧密的联系。
Stubblebine 指出,Medium 正在经历一些变化,他认为这些变化最终将对作者、读者和出版物都有好处。他提到,Medium 一直有出版物存在,这些出版物类似于群体博客和子版块,帮助设定质量标准并为文章提供反馈。他鼓励部分读者创建自己的出版物,并为此提供了一些指导原则。对于作者而言,这意味着在 Medium 上有更多的出版物可供投稿。
在 Better Programming 关闭后, Michael Long 告诉我他创建了一份专注于 Swift、SwiftUI 方面的新出版物:The Swift Cooperative ,因此我将有关 ViewThatFits 的文章发表在这个新刊物上。
作为一个中文博主,我开始发表文章英文版本的目的非常单纯,就是想检验一下,自己在中文世界中对 Swift、SwiftUI 的一些分享是否同样在英文世界( 或更大的读者群体 )中同样具备价值。为了能够让文章在一开始就能被人阅读到,我选择了无需推广便有可能获得阅读量的 Medium 平台。从今年四月份开始,我逐步对之前发表在自己中文 博客 的文章进行翻译并发表在 Medium 上,在 Better Progrmming、ITNEXT 这些出版物的帮助下,在本周,我在 Medium 上的关注正好突破了一千人。读者量和阅读量的不断攀升,让我获得了更多的动力,并结识了不少新的朋友。
目前我正在重构我的中文博客。从 2024 年开始,我将会在上面同时发表文章的中英双语版本。在下一篇博文中,我会分享最近重构博客时使用 AI 的一些体会。
如果您发现这份周报或我的博客对您有所帮助,可以考虑通过 Patreon, Buy Me a Coffee, 微信 支持我的创作。
原创
掌握 ViewThatFits
在 iOS 16 中,SwiftUI 增加了一个新的自适应布局容器 ViewThatFits。正如其名称所示,它的作用是在给定的多个视图中找出最合适的视图并使用。对于大多数人来说,这是一个简单易用的容器。不过,本文打算对其进行彻底的剖析,包括规则细节、理想尺寸的含义、使用示例等。最后,我们将创建一个复刻版本的 ViewThatFits,以加深对其的认识和理解。
近期推荐
Introducing Inferno: Metal shaders for SwiftUI
在 WWDC 2023 上,苹果为 SwiftUI 添加了几个新的修饰器。通过这些修饰器,开发者可以方便地将 Metal Shader 应用于视图。然而,在实际应用中,我们会发现尽管使用起来很方便,但大多数开发者并不会编写 Shader,并且可供参考的资料和素材相对有限。
为了改善这种情况,Paul Hudson 创建了 Inferno 项目,一个开源的 Fragment Shader 集合。现在即使没有 Shader 编写经验,我们也能轻松地将 Shader 应用于自己的应用程序中。随着这个项目,Paul 还提供了两个视频:一个是 介绍短片,另一个是 创建自定义 Shader。此外,他还为 HackingWithSwift 的订阅者开发了一门新的 Shader 课程。
Debugging SwiftUI views: what caused that change?
几乎所有使用 SwiftUI 的开发者都会遇到一个问题,即由于视图在多个触发器的作用下频繁重绘,导致应用性能下降、动画异常,并且在排查问题时也无从下手。在本文中, Antoine van der Lee 不仅将揭示了这一难题的本质,还提供了清晰的示例和解决方案,让你避免落入“Massive SwiftUI Views”的陷阱。无论您是 SwiftUI 的初学者还是资深开发者,这篇文章可以为你的开发工作带来新的视角和技能。
Macro Bonanza
Swift 的宏在推出后受到了广泛好评。Point-Free 也将它应用于他们的四个流行库中:CasePaths、ComposableArchitecture、SwiftUINavigation 和 Dependencies。在这篇文章中,作者展示了 Swift 宏如何极大地简化和增强了这些库的能力,包括:简化代码结构、提高 API 的直观性和易用性、增强功能和灵活性以及改善测试和调试。尽管这几个库起源于 The Composable Architecture(TCA),但它们同样适用于其他架构的应用。即使你不使用 TCA,这几个库也会对你的开发有很大的帮助。
Questions about the data to create LLMs for embeddings
在这篇文章中,Joseph Heck 将围绕大型语言模型(LLM)的数据来源和性能问题进行探讨。他首先表达了对训练这些大型语言模型的数据来源的关心,由于对来源的不自信,导致他无法将结果应用于开源项目。其次,他也就模型大小与性能、数据管理与模型更新的问题提出了自己的看法。最后,Heck 表达了寻找基于“清洁数据源”的 LLM 的愿望,他认为收集和整理多语言数据所做的工作要比数据使用本身更加繁重,这将超出个人能力,需要学术机构、公司乃至整个社会的资源。
LLM 数据来源合法性的问题长期以来都没有得到有效的解决和确认。随着 OpenAI CEO Sam Altman 的突然被罢免,这个问题将再次受到社会的关注。
ObservationBP
在 第二期周报 中,我们介绍了由 onevact 创建的 ObservationBP 项目。该项目将 Observation 框架的能力带到了低版本的 SwiftUI 中。然而,在当前的实现中,开发者需要为每个调用了 Observable 实例的属性视图进行显式的包装。如果该视图中包含其他的 Lazy 视图,则还需要进行二次包装,这增加了使用者的负担。基于 onevacat 的工作,winddpan 进行了调整,现在开发者可以以接近 Observation 原生的方式(只需调整或增加一个属性包装器)在低版本的 SwiftUI 中使用 ObservationBP 库。
活动
iOS Conf SG 2024
iOS Conf SG 将于 2024 年 1 月 18 至 19 日在新加坡举行,这已经是该活动的第九届会议了。与往届一样,会议主办方邀请了不少业界大佬,例如:Paul Hudson、Maxim Cramer、Ellen Shapiro 、Rudrank Riyam 等出席并做专题演讲。
在本届中,也将有三位中文演讲者,他们分别是:
来自台湾的 Charlene Ho,拥有超过 11 年产品和用户研究经验的 ByteDance 用户研究员。她的分享将帮助你更好地深入了解用户的行为、偏好和需求。
来自马来西亚的 Lee Kah Seng,知名的 Swift Senpai 技术博主,拥有十年 iOS 开发经验的技术顾问。他将分享「Swift Actor 陷阱」,帮助开发者避免常见错误,提升 App 性能。
来自新加坡的 Junda Ong,一位经验丰富的独立 iOS 开发者。曾在 ShopBack 和加密货币领域工作,并开发了多项独立 App。
会议主办方诚挚地邀请中文开发者关注本次会议并报名参与。
可以访问 iOS Conf SG 的 官网 了解更多信息。如果有其他的问题,也可以在我的 Discord 服务器 iOS Conf Sg 频道 中,与会议的工作人员进行交流。