最新发布第21页
Day 15 - 咖啡机-Stewed Noodles 资源

Day 15 – 咖啡机

MENU = { 'espresso': { 'ingredients': { 'water': 50, 'coffee': 18, }, 'cost': 1.5, }, 'latte': { 'ingredients': { 'water': 200, 'milk': 150, 'coffee': 24, }, 'cost': 2.5, }, 'cappu...
Day 17 - 自定义类(Class)-Stewed Noodles 资源

Day 17 – 自定义类(Class)

自定义类 类定义的语法,如下 # 类的定义, ClassName必须首字母大写 class ClassName: # 类的对象 class_name_1 = ClassName() 常见的几种命名方式- PascalCase - camelCase - snake_case 构造...
文档竖版标签-Stewed Noodles 资源

文档竖版标签

文档竖版标签样式,如下所示 文档竖版标签.docx下载docx文件14.1K  
XuX的头像-Stewed Noodles 资源烩之面大会员XuX1年前
0260
查询数据-Stewed Noodles 资源

查询数据

SwiftData 提供了 @Query 宏,用于从 SwiftUI 视图中查询模型对象,并可选择提供排序顺序、过滤谓词,以及用于平滑处理结果变化的自定义动画或自定义事务。更棒的是,@Query 会在每次数据变化时...
如何动态更改查询的排序顺序或谓词-Stewed Noodles 资源

如何动态更改查询的排序顺序或谓词

要实现动态排序,您需要将@Query属性移至 SwiftUI 层次结构中的视图中 - 您需要将其放入子视图中,在其中可以使用依赖项注入提供排序值。 这意味着创建一个新的 SwiftUI,它使用@Query来显示您...
What’s the difference between await and async let? await 和 async let 有什么区别?-Stewed Noodles 资源

What’s the difference between await and async let? await 和 async let 有什么区别?

Swift lets us perform async operations using both await and async let, but although they both run some async code they don’t quite run the same: await wai...
How to create continuations that can throw errors 如何创建可以抛出错误的continuations-Stewed Noodles 资源

How to create continuations that can throw errors 如何创建可以抛出错误的continuations

Swift provides withCheckedContinuation() and withUnsafeContinuation() to let us create continuations that can’t throw errors, but if the API you’re using ...
How to make async command-line tools and scripts 如何制作异步命令行工具和脚本-Stewed Noodles 资源

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...
How to set a time limit for concurrent tests 如何为并发测试设置时间限制-Stewed Noodles 资源

How to set a time limit for concurrent tests 如何为并发测试设置时间限制

Both Swift Testing and XCTest have simple mechanisms for controlling how long tests should be allowed to run before being considered a failure. This is critically important for con...
How to force concurrent tests to run on a specific actor 如何强制并发测试在特定actor上运行-Stewed Noodles 资源

How to force concurrent tests to run on a specific actor 如何强制并发测试在特定actor上运行

Swift Testing and XCTest behave differently when it comes to running tests in parallel: unless you say otherwise, Swift Testing will run both synchronous and asynchronous tests on ...