如何将 SwiftData 与 iCloud 同步
Xcode配置 如果要将应用程序的数据同步到 iCloud,请转到应用程序Target的 Signing & Capabilities 设置 添加 iCloud 功能 点击 + Capability 按钮,选择 iCloud 功能 选择 CloudKit 在 iCl...
What’s the difference between Sequence, AsyncSequence, and AsyncStream? Sequence、AsyncSequence 和 AsyncStream 之间有什么区别?
Swift provides several ways of receiving a potentially endless flow of data, allowing us to read values one by one, or loop over them using for, while, or similar.Swift ...
What are tasks and task groups? 什么是任务和任务组?
Using async/await in Swift allows us to write asynchronous code that is easy to read and understand, but by itself it doesn’t enable us to run anything concurrently – even w...
How to get a Result from a task 如何从任务中获取 Result
If you want to read the return value from a Task directly, you should read its value using await, or use try await if it has a throwing operation...
How to cancel a task group 如何取消任务组
Swift’s task groups can be cancelled in one of three ways: if the parent task of the task group is cancelled, if you explicitly call cancelAll() on the group, or if one of your ...
How to create and use task local values 如何创建和使用任务本地值
Swift lets us attach metadata to a task using task-local values, which are small pieces of information that any code inside a task can read.Swift 允许我们使用 task-local ...
What is actor hopping and how can it cause problems? 什么是 actor 跳转,它如何导致问题?
When a thread pauses work on one actor to start work on another actor instead, we call it actor hopping, and it will happen any time one actor calls another.当线程暂停对一个 a...
How to set a time limit for concurrent tests 如何为并发测试设置时间限制
Both Swift Testing and XCTest have simple mechanisms for controlling how long tests should be allowed to run before being considered a failure. This is critically important for con...
Tap Sudoku
In final stream in this miniseries about making games with SwiftUI, we’re going to create a mini sudoku game from scratch. It’s pretty packed, but a fantastic starting point for ...