Has Your App Been Defeated by the New System?

Fatbobman's Swift Weekly #050

Sep 23, 2024

Since beta 7, I’ve upgraded all my Apple devices to this year’s new system. After using it for a while, I felt this year's update seemed much more stable than the past two years. However, it turns out...

NSManagedObjectID and PersistentIdentifier: Mastering Data Identifiers in Core Data and SwiftData

Core Data and SwiftData are powerful data management frameworks designed by Apple for developers, capable of efficiently handling complex object relationships, hence known as object graph management frameworks. In these two frameworks, NSManagedObjectID and PersistentIdentifier serve similar functions and are both extremely important. This article will delve into their features, usage methods, and important considerations.

Mastering Data Binning with Swift Charts

Data binning is a commonly used data processing technique that typically divides continuous numerical or temporal data into multiple intervals (which are mostly adjacent and non-overlapping). This method not only covers the entire data range but also provides clear demarcation for data points within each interval. By performing data binning, we can analyze, visualize, and statistically process complex datasets more effectively. This article will explore how to use the advanced APIs provided by Swift Charts to achieve precise and efficient data binning.

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!

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