摘要: // // SceneDelegate.swift // 菜鸟教程 // // Created by udc on 2019/11/29. // Copyright © 2019 udc. All rights reserved. // import UIKit class SceneDelegat 阅读全文
posted @ 2020-04-03 13:13 liuw_flexi 阅读(1309) 评论(0) 推荐(0) 编辑
摘要: Code enum Week: CaseIterable { case Sun case Mon case Tue case Wen case Thu case Fri case Sat } print(Week.allCases) //也可以重写allCases方法 enum Week2: Cas 阅读全文
posted @ 2020-04-03 12:03 liuw_flexi 阅读(764) 评论(0) 推荐(0) 编辑
摘要: // struct Animal: Codable{ // var name: String // var age: Int // } // // let jsonStr = "{\"name\" : \"dog\", \"age\" : 5}" // guard let jsonData = js 阅读全文
posted @ 2020-04-03 11:58 liuw_flexi 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 参考 https://www.jianshu.com/p/06c993c5ad89 只有遵循了Hashable 协议 才能被添加到 Set 中 或者用作 Dictionary 的 key 值。 比较结构体和类的不同,类必须要实现Hashable的协议方法 struct Person:Hashable 阅读全文
posted @ 2020-04-03 11:56 liuw_flexi 阅读(768) 评论(0) 推荐(0) 编辑
摘要: https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation 其实Identifiable 非常简单实用,主要作用就是作为一个对象的唯一标识。 在创建地标列表时: List(landmarkData, id: 阅读全文
posted @ 2020-04-03 11:52 liuw_flexi 阅读(1216) 评论(0) 推荐(0) 编辑