姚宁的博客

Swift备忘录

  1. Any解包
    func unwrap<T>(_ any: T) -> Any {
     let mirror = Mirror(reflecting: any)
     guard mirror.displayStyle == .optional, let first = mirror.children.first else {
         return any
     }
     return unwrap(first.value)
    }
    

一些链接

聊聊swift语言中的“??”