十一月第三周

2018-11-18  本文已影响24人  玉思盈蝶

1.CocoaPods更新第三方库报错处理:


屏幕快照 2018-11-10 下午1.49.38.png

后面再试了就好了,可能是网络问题吧。

2.Swift优秀第三方:
DeviceKit:
https://github.com/dennisweissmann/DeviceKit

图片浏览:JXPhotoBrowser

钥匙串访问:KeychainAccess
https://github.com/kishikawakatsumi/KeychainAccess

动态提示效果:PKHUD
https://github.com/pkluz/PKHUD

Swift常用的第三方扩展:SwifterSwift
https://github.com/SwifterSwift/SwifterSwift

Websockets的封装使用: Starscream
https://github.com/daltoniam/Starscream

3.Swift中的Codable:

struct Person: Codable {
  var name: String
  var age: Int
  var quest: String
}

编译器会自动生成对应的 key 嵌套在 Person 类中。如果我们自己来做这件事情,这个嵌套类型会是这样的。

private enum CodingKeys: CodingKey {
  case name
  case age
  case quest
}

如果我们需要用不同的名称, 只需要提供我们自己的 CodingKey 。

private enum CodingKeys:String, CodingKey {
  case name = "person_name"
  case age
  case quest
}

这样写就会让 Person 的 name 属性通过 “person_name”来实现编码和解码。

4.关于collectionView.performBatchUpdates()方法:
https://blog.csdn.net/jamy08/article/details/50505859

5.Swift实现数组遍历:

let array:[String] = ["1","2","3"]
(arrayasNSArray).enumerateObjects({ (obj, idx, stop) in
   print("idx:\(idx) value:\(obj)") })

for(index, value) in array.enumerated() {
   print("idx:\(index) value:\(value)") 
}

6.6. == 和===的区别:
https://juejin.im/post/5be1901ff265da61590b241e

上一篇 下一篇

猜你喜欢

热点阅读