最新发布第27页
How to create a custom AsyncSequence 如何创建自定义 AsyncSequence-Stewed Noodles 资源

How to create a custom AsyncSequence 如何创建自定义 AsyncSequence

There are only three differences between creating an AsyncSequence and creating a regular Sequence, none of which are complicated.创建 AsyncSequence 和创建...
Is it efficient to create many tasks? 创建许多任务是否有效?-Stewed Noodles 资源

Is it efficient to create many tasks? 创建许多任务是否有效?

Previously I talked about the concept of thread explosion, which is when you create many more threads than CPU cores and the system struggles to manage them effectively. Howev...
What is actor hopping and how can it cause problems? 什么是 actor 跳转,它如何导致问题?-Stewed Noodles 资源

What is actor hopping and how can it cause problems? 什么是 actor 跳转,它如何导致问题?

When a thread pauses work on one actor to start work on another actor instead, we call it actor hopping, and it will happen any time one actor calls another.当线程暂停对一个 a...
匿名函数-Stewed Noodles 资源

匿名函数

匿名函数:没有名字的函数。 语法 基本语法 val anonymousFunction = fun(parameters): ReturnType {    body    return statement if needed} 示例代码 val numbers =...
高阶函数-Stewed Noodles 资源

高阶函数

高阶函数可以接受一个或多个函数作为参数,也可以讲一个函数作为返回值。 fun operateOnNumbers(a: Int, b: Int, operation: (Int, Int) -> Int): Int { return operation(a, b) } // 函数的使...
NavHostController-Stewed Noodles 资源

NavHostController

基本介绍 NavHostController 是 Jetpack Compose Navigation 中负责管理导航状态的核心控制器。 记录当前在哪个页面(destination) 处理导航动作(navigate / popBackStack) 管理返回栈(Back...
Data Class 数据类-Stewed Noodles 资源

Data Class 数据类

Kotlin 中的 数据类(data class) 是一种用于只存数据的类,能够自动生成常用的函数。 equals() hashCode() toString() copy() 语法 data class ClassName( val prop: Type, var prop2: Type )...
Day 13 - 调试 Debugging-Stewed Noodles 资源

Day 13 – 调试 Debugging

代码调试中的几种方法以及建议。 描述问题,代码执行的目的是什么,实现的流程是什么 复现问题,调试 Bug 的前提 Play Computer,能够像计算机一样逐行浏览代码,以便找出问题所在。 修复错误,...
withAnimation-Stewed Noodles 资源

withAnimation

使用提供的动画重新计算视图主体,并返回结果。 struct ContentView: View { @State private var isActive = false var body: some View { VStack(alignment: isActive ? .trailing : .leading)...
XuX的头像-Stewed Noodles 资源烩之面大会员XuX1年前
0290
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...