最新发布第21页
排序
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 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 make async command-line tools and scripts 如何制作异步命令行工具和脚本
If you’re writing a command-line tool with Swift, you can use async code in two ways: if you're using main.swift you can immediately make and use async functions as norm...
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 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...
NumPy 的使用
NumPy 用于处理多维数组或矩阵。具体的使用步骤 引入NumPy库 矩阵基本运算 基本使用 import numpy as np # 创建一维数组 arr1 = np.array([1, 2, 3, 4, 5]) # 打印数组 print('一维数组:', arr1...
OpenCV 打开图片并显示
OpenCV 的基本使用: 引入 OpenCV 库 : import cv2 调用 OpenCV API 代码示例 # 使用OpenCV打开图片,并显示图片 import cv2 # 读取图片 image = cv2.imread('flow.jpg') # 显示图片 # 第一个参...