最新发布第29页
排序
How to call an async function using async let 如何使用 async let 调用 async 函数
Sometimes you want to run several async operations at the same time then wait for their results to come back, and the easiest way to do that is with async let. This lets you start...
Sending data safely across actor boundaries 跨参与者边界安全地发送数据
Swift tries to ensure access to shared data is done safely, partly through types such as actors, and partly through a concept of sendability implemented through the ...
Introduction to testing Swift concurrency Swift 并发测试简介
Swift's full range of concurrency features work great with unit tests using both the legacy XCTest framework and the new Swift Testing framework.Swift 的全套并发功能非常适合使用旧...
How to test completion handlers with Swift Testing and XCTest 如何使用 Swift Testing 和 XCTest 测试补全处理程序
When you're dealing with older concurrency code that relies on callback functions that get run when some work completes rather than using Swift concurrency's async/await ...
How to test AsyncSequence and AsyncStream 如何测试 AsyncSequence 和 AsyncStream
Concurrent Swift code often streams values over time rather than returning them all at once, so it's important to be able to write tests to check an AsyncStream, AsyncSeq...
How to create and use async properties 如何创建和使用异步属性
Just as Swift’s functions can be asynchronous, computed properties can also be asynchronous: attempting to access them must also use await or similar, and may also need&...
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...
多对多关系
在SwiftData 中,当关系的双方都使用数组时,就会创建多对多关系。这类关系相当常见,比如:一个老师有多个学生,一个学生可以有多个老师;一个演员参演了多部电影,一部电影也有许多演员参与;...
级联关系删除
SwiftData 默认的关系删除规则是.nullify,这意味着如果一个 School 对象与多个 Student对象关联,删除 School 后,学生对象仍会保留在数据存储中。在某些情况下这是合理的,但你也可以使用.cas...

