Day 2 – 理解数据类型和字符串操作
基本数据类型 String 字符串下标 字符串的下标 Subscripting可以提取字符串特定位置的字符。 # 提取第一个字符 print('Hello'[0]) # H # 提取最后一个字符 print('Hello'[len('Hello') - 1]) # ...
Day 6 – 函数
Python 内置函数的详情可参考 https://docs.python.org/zh-cn/3.13/library/functions.html 函数定义 无参函数的语法 # 函数定义 def <function name>(): # Do something # 函数调用 <...
Day 13 – 调试 Debugging
代码调试中的几种方法以及建议。 描述问题,代码执行的目的是什么,实现的流程是什么 复现问题,调试 Bug 的前提 Play Computer,能够像计算机一样逐行浏览代码,以便找出问题所在。 修复错误,...
Animation
当指定的值发生变化时,将给定的动画应用于此视图。 struct ContentView: View { @State private var scale = 0.5 var body: some View { VStack { Circle().scale(scale).animation(.easeIn, v...
Transaction
当前状态处理更新的上下文。 transaction(value:_:) 使用.transaction 修饰符来更改或替换视图中使用的动画。考虑一个由按钮控制的三个相同视图,同时改变所有三个的情况: 第一个视图通过旋转...
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 ...





