jiulinxiri-Stewed Noodles 资源-第8页
jiulinxiri的头像-Stewed Noodles 资源
超级管理员河南管理员
一拳之石取其了坚,一勺之水取其净!
How to discard results in a task group 如何丢弃任务组中的结果-Stewed Noodles 资源

How to discard results in a task group 如何丢弃任务组中的结果

Swift has a special task group type called a discarding task group, which has a very specialized function: tasks that complete are automatically discarded and destroyed, ...
How to handle different result types in a task group 如何处理任务组中的不同结果类型-Stewed Noodles 资源

How to handle different result types in a task group 如何处理任务组中的不同结果类型

Each task in a Swift task group must return the same type of data as all the other tasks in the group, which is often problematic – what if you need one task group to handle ...
How to cancel a task group 如何取消任务组-Stewed Noodles 资源

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 a task group and add tasks to it 如何创建任务组并向其添加任务-Stewed Noodles 资源

How to create a task group and add tasks to it 如何创建任务组并向其添加任务

Swift’s task groups are collections of tasks that work together to produce a single result. Each task inside the group must return the same kind of data, but if you use enum assoc...
How to voluntarily suspend a task  如何自愿暂停任务-Stewed Noodles 资源

How to voluntarily suspend a task 如何自愿暂停任务

If you’re executing a long-running task that has few if any suspension points, for example if you’re repeatedly iterating over an intensive loop, you can call Task.yield()&n...
How to cancel a Task 如何取消任务-Stewed Noodles 资源

How to cancel a Task 如何取消任务

Swift’s tasks use cooperative cancellation, which means that although we can tell a task to stop work, the task itself is free to completely ignore that instruction and carry...
Understanding how priority escalation works 了解优先级提升的工作原理-Stewed Noodles 资源

Understanding how priority escalation works 了解优先级提升的工作原理

Every task can be created with a specific priority level, or it can inherit a priority from somewhere else. But in two specific circumstances, Swift will raise the priori...
How to control the priority of a task 如何控制任务的优先级-Stewed Noodles 资源

How to control the priority of a task 如何控制任务的优先级

Swift tasks can have a priority attached to them, such as .high or .background, but the priority can also be nil if no specific priority was assigned. This...
How to get a Result from a task 如何从任务中获取 Result-Stewed Noodles 资源

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 make a task sleep 如何使任务进入休眠状态-Stewed Noodles 资源

How to make a task sleep 如何使任务进入休眠状态

Swift’s Task struct has a static sleep() method that will cause the current task to be suspended for a set period of time. You need to call Task.sleep()&n...