随笔分类 -  swift

SwiftUI 的状态管理
摘要:@State 被@State包装的值发生改变时,UI将被同时改变 struct ContentView: View { @State var title = "HelloWorld" var body: some View { VStack { Text(title) Button { title 阅读全文

posted @ 2022-12-05 23:18 Lemo_wd 阅读(194) 评论(0) 推荐(0)

SwiftUI 入门
摘要:[文档](https://developer.apple.com/documentation/swiftui/) ## 1 组件 ### 1.1 基础组件 #### Text ```swift Text("Hamlet") .font(.largeTitle) .fontWeight(.bold) 阅读全文

posted @ 2022-12-03 15:54 Lemo_wd 阅读(711) 评论(0) 推荐(0)

Swift 基础语法
摘要:原文 英文原文 简单值 类型不会自动转换,需要手动转换: let label = "The width is " let width = 94 let widthLabel = label + String(width) 字符串插值语法 () let apples = 3 let oranges = 阅读全文

posted @ 2022-12-02 21:19 Lemo_wd 阅读(89) 评论(0) 推荐(0)

导航