最新发布第10页
排序
How to use @MainActor to run code on the main queue 如何使用 @MainActor 在主队列上运行代码
@MainActor is a global actor that uses the main queue for executing its work. In practice, this means methods or types marked with @MainActor can (for the most part)...
How to download JSON from the internet and decode it into any Codable type 如何从 Internet 下载 JSON 并将其解码为任何 Codable 类型
Fetching JSON from the network and using Codable to convert it into native Swift objects is probably the most common task for any Swift developer, usually followed by dis...
语法(三) – guard
guard 语句的主要用法有以下几种: 提前返回 减少缩进级别 高Happy Path可见性 提前返回 guard 用于提前返回,如果某些先决条件未满足,则退出函数。 func giveAward(to name: String) { guard n...
Day 19 – 实例、状态和高级函数
事件监听 turtle模块的事件监听,通过 screen 的 listen 方法实现。 from turtle import Turtle, Screen tim = Turtle() screen = Screen() def move_forward(): tim.forward(100) # 监听屏幕输...
如何将 SwiftData 与 iCloud 同步
Xcode配置 如果要将应用程序的数据同步到 iCloud,请转到应用程序Target的 Signing & Capabilities 设置 添加 iCloud 功能 点击 + Capability 按钮,选择 iCloud 功能 选择 CloudKit 在 iCl...
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...
How to write basic async tests 如何编写基本的异步测试
Both Swift Testing and XCTest allow us to test asynchronous code built with Swift concurrency by marking tests as async. This means we can wait for concurrent code to complete...
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...
物资、设备与资产
采购阶段 在采购阶段设备以物资的形式呈现,采购阶段主要是物资的采购、到货以及验收。物资形式下的设备拥有物资编码。 设备建档 物资采购完成后,可以进行设备建档,设备建档会生成设备编码。 ...





