Weekly Comment
2024 marks the sixth year since I received a kidney transplant. Reflecting on this year, my personal health has been stable and smooth. As the year drew to a close, I received two exciting pieces of news—two groundbreaking advancements in xenotransplantation of kidneys, which fill me with hope for the future:
- The latest research results announced by Professor Chen Gang’s team in China show that a monkey that received a gene-edited pig kidney has successfully survived for six months. For organ transplant patients, the first six months post-surgery are the most critical and life-threatening period. Successfully passing this period significantly increases the likelihood of long-term survival.
- 53-year-old Towana Looney underwent a gene-edited pig kidney transplant at NYU Langone Health, after which her health stabilized, and she was successfully discharged on December 6th (11 days post-surgery).
Kidney transplantation is the most ideal treatment for patients with uremia. However, the shortage of donor organs means that many patients cannot receive transplant surgery in a timely manner. To address this challenge, the scientific community has been exploring multiple avenues, with xenotransplantation undoubtedly being the most promising path.
With the rapid advancement of gene-editing technology, the progress in xenotransplantation has accelerated. In recent years, this field has made continuous progress. However, despite the relentless efforts of researchers, until today, there have been no successful long-term survival cases of live transplants.
Towana Looney’s case is undoubtedly a milestone breakthrough. She was not only a kidney donor in the past but has now become a beneficiary of xenotransplantation, making her the best witness to this technological breakthrough. Her resilience and courage bring hope to millions of patients waiting for organs. As a transplant patient myself, I sincerely wish her a speedy recovery and a return to a warm family life.
At the same time, I am deeply grateful to all the researchers, doctors, and team members involved in the research and treatment of xenotransplantation. It is their selfless dedication and continuous innovation that have allowed us to see the light in the face of such a significant challenge. I firmly believe that as xenotransplantation technology continues to mature, more patients like Towana will be reborn through this technology in the future.
This Week’s SponsorThe Midst: Share Locally, Connect Globally
The Midst redefines instant messaging with a geo-focused twist! Posts are tied to your location, visible only to those exploring your area. As both an info hub and a megaphone for your ideas, The Midst is perfect for sharing breaking news or spontaneous thoughts. With posts disappearing after 24 hours, the platform remains fresh and dynamic.
Originals
Traps and Countermeasures for Abnormal onAppear Calls in SwiftUI
onAppear
is an extremely crucial lifecycle method in SwiftUI, used to inject key logic when a view is presented. Since view instances may be created and rebuilt frequently, developers often choose to prepare data and perform initialization operations within these methods. In theory, the timing of these lifecycle method calls should be predictable and consistent. However, in certain specific scenarios, onAppear
may be called unexpectedly and unnecessarily. This not only can lead to performance overhead but also may cause uncontrollable changes in the application’s state. This article will uncover this easily overlooked SwiftUI behavior trap and provide temporary countermeasures.
Recent Selections
The Ultimate Guide to Validation Patterns in SwiftUI
Validation ensures that applications handle accurate and meaningful data by providing clear feedback to help users correct invalid input and enhance the user experience. Mohammad Azam showcases several validation patterns available in SwiftUI, ranging from simple form validation to advanced real-time feedback and reusable component implementations. Azam also draws inspiration from Flutter’s live validation and ASP.NET’s model validation methods, highlighting the importance of cross-framework learning. This article serves as a powerful guide for developers to build efficient validation mechanisms.
SwiftUI Data Flow: Passing Data Between Views
Data flow is a key topic of discussion in SwiftUI. Matteo Manferdini provides a detailed overview of common SwiftUI data transfer mechanisms, including @State
, @Binding
, and @Environment
, while exploring how these mechanisms integrate with app architectures like MVC and MVVM to achieve clear and flexible data management. A standout feature of this article is its use of intuitive flowcharts to help readers understand the movement of data between views and models.
Xcode Library Customization with SPM Plugin
By implementing the LibraryContentProvider
protocol, developers can add custom components, such as SwiftUI views and modifiers, to the Xcode Library for quick reuse within projects. However, this approach requires manual updates to the code, which can be time-consuming. Artem Novichkov proposes an automated solution using the Swift Package Manager (SPM) plugin. By parsing Swift source code, the plugin automatically extracts structs conforming to the View
protocol and generates the corresponding LibraryContent.swift
file, dynamically integrating these components into the Xcode Library. This method showcases the power of SPM plugins and SwiftSyntax, providing developers with a more flexible toolchain.
Noncopyable Types in Swift
In Swift, types are copyable by default. However, in certain scenarios, copyability can lead to issues. To address this, Swift 5.9 introduced noncopyable types, offering developers stricter ownership control. Natalia Panferova provides an in-depth explanation of the usage and considerations of noncopyable types. While these types might not be suitable for every project, they are a highly effective tool for scenarios requiring unique ownership, enhancing code safety and efficiency.
Sending vs Sendable in Swift
The sending
keyword introduced in Swift 6 provides a more flexible approach to concurrent programming. Unlike the stricter limitations of @Sendable
, sending
allows capturing non-Sendable
types but ensures that these objects cannot be accessed outside the closure, thereby avoiding potential data race issues. In this article, Donny Wals explores the differences between sending
and Sendable
, explaining why the Swift team transitioned task and closure parameters from @Sendable
to sending
. This improvement enhances Swift’s support for complex concurrency scenarios, making it a standout feature in Swift 6.
Creating a SwiftUI Text View with Tappable Links
While developers can directly use Markdown text within Text
, this approach lacks flexibility. To address this, Daniel Saidi introduced the LinkText
component in SwiftUIKit. LinkText
allows developers to combine plain text and tappable links within a single view, apply unique styles to each link, and inject global styles. This method simplifies code and enhances maintainability, making it a practical solution for building interactive text views in SwiftUI.