Societal Progress Through the Lens of Driver's License Medical Examinations

Fatbobman's Swift Weekly #047

Sep 2, 2024

A week ago, I received a notification from the Traffic Police App informing me that it was time to renew my driver's license. A decade has passed since my last renewal, during which both the regulatio...

Aug 14, 2024
Considerations for Using Codable and Enums in SwiftData Models

Compared to Core Data, SwiftData has fundamentally revolutionized the way data models are constructed. It not only supports a purely code-based declaration method but also allows the direct use of types conforming to the Codable protocol and enum types within models, which are its significant new features. Many developers are inclined to leverage these new capabilities because they seem to fit very well with the Swift language's declaration style. However, a lack of understanding of the implementation details and potential limitations of these new features may lead to various issues in the future. This article aims to discuss several key points to consider when using Codable and enums in SwiftData models, helping developers avoid common pitfalls.

Aug 7, 2024
Nested Grid Layout Anomaly: Analysis Approach and Resolution Strategies for SwiftUI Layout Issues

After six iterations, SwiftUI is no longer a nascent framework. However, developers still occasionally encounter various peculiar issues stemming from bugs in the framework's code during its use. This article will dissect an instance of a Grid layout anomaly to explore analytical approaches and resolution strategies for addressing issues in day-to-day SwiftUI development.

Jul 31, 2024
How to Tile Images in SwiftUI

Although image tiling is not a commonly used feature, most developers can easily master its implementation. A search engine query reveals that almost all results point to the same solution — using the `resizable` modifier. However, for a powerful UI framework, it is clearly not comprehensive to have only one solution for a requirement. In this article, we will explore two different implementations of image tiling and from there, introduce a less commonly used `Image` construction method in SwiftUI.

Jul 24, 2024
Common Misconceptions About SwiftUI

This article aims to explore several common misconceptions of SwiftUI to help developers better understand and utilize SwiftUI. We will dissect these misconceptions, including those about the perceived difficulty of learning SwiftUI, expectations of cross-platform development, the scope of framework capabilities, and misunderstandings about the amount of code involved. By clarifying these concepts, we hope to provide clearer learning directions and usage strategies for SwiftUI developers.

Developing an Infinite Four-Direction Scrollable Pager with SwiftUI

The advent of SwiftUI has brought revolutionary changes to Apple ecosystem development, but it still faces some challenges when addressing certain complex requirements. Recently, I developed a component called Infinite4Pager, which supports infinite four-direction scrollable paging. In this article, we will analyze the key ideas in the implementation process, discuss the points that need special attention, and candidly review the shortcomings of SwiftUI in coping with such scenarios. Through this case, we not only learn the specific technical implementation but also better understand how to break through the convention and solve problems creatively within the framework of SwiftUI.

Jul 12, 2024
Techniques for Automatic Merging of String Catalogs in Multi-Package Monorepos

By Luca Ban

Announced at WWDC23, Swift introduces an amazing new way for internationalization (i18n) for Swift apps and packages with String Catalogs. This guide covers the basics of getting started with String Catalogs in a new project: WWDC23 String Catalogs. However, it doesn't touch on a use case where there is a single monorepo with multiple Swift packages (and there are no sample projects). In this article, we'll explore how to set up your monorepo so each Swift Package can have its own String Catalog, which gets auto-merged into one when building your host app, without breaking a sweat!

Jul 10, 2024
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.

Swifter and Swifty: Mastering the Swift Testing Framework

Since the inception of the Swift language, XCTest has been the preferred testing framework for the majority of Swift developers. However, deeply rooted in Objective-C, its API design heavily borrows from the traditions of that language, failing to fully reflect the modern best practices of Swift programming. In some respects, this has even become a barrier to further development. To overcome these limitations, Apple officially introduced Swift Testing at WWDC 2024—a new testing framework specifically designed for the Swift language. This framework has been integrated into Xcode 16 and positioned as the official testing tool of choice. In this article, we will delve into the features, usage, and unique aspects of the Swift Testing framework, analyzing how it helps developers write test codes faster (Swifter) and more in line with Swift programming habits (Swifty).

Weekly Swift & SwiftUI insights, delivered every Monday night. Join developers worldwide.
Easy unsubscribe, zero spam guaranteed