How to use continuations to convert completion handlers into async functions 如何使用 continuations 将完成处理程序转换为异步函数
Older Swift code uses completion handlers for notifying us when some work has completed, and sooner or later you’re going to have to use it from an async function –&nbs...
How to store continuations to be resumed later 如何存储要稍后恢复的 continuations
Many of Apple’s frameworks report back success or failure using multiple different delegate callback methods rather than completion handlers, which means a simple continuation won...
How to loop over an AsyncSequence using for await 如何使用 for await 遍历 AsyncSequence
You can loop over an AsyncSequence using Swift’s regular loop types, for, while, and repeat, but whenever you read a value from the async sequence you mus...
How to convert an AsyncSequence into a Sequence 如何将 AsyncSequence 转换为 Sequence
Swift does not provide a built-in way of converting an AsyncSequence into a regular Sequence, but often you’ll want to make this conversion yourself so you don’t n...
What is an actor and why does Swift have them? 什么是 actor,为什么 Swift 有它们?
Swift’s actors are conceptually like classes that are safe to use in concurrent environments. This safety is made possible because Swift automatically ensures no two pieces of cod...
How to handle concurrency errors in unit tests 如何处理单元测试中的并发错误
Both Swift Testing and XCTest give us three main options for handling errors in tests: we can consider them immediate failures, we can handle them internally and make our own asser...
SUSAR 上传错误
时间格式 严重事件发生时间格式 2024/01/03或者 NA,不能是其它格式,比如 2024-01-03。 Excel 单元格换行 Excel 单元格中,不能出现换行。 单元格出现换行 转归列 转归所在的列为单选,选项出...
Day 2 – 理解数据类型和字符串操作
基本数据类型 String 字符串下标 字符串的下标 Subscripting可以提取字符串特定位置的字符。 # 提取第一个字符 print('Hello'[0]) # H # 提取最后一个字符 print('Hello'[len('Hello') - 1]) # ...







