美文网首页iOS面试资料搜集
一文鉴定是Swift的王者,还是青铜

一文鉴定是Swift的王者,还是青铜

作者: 一意孤行的程序猿 | 来源:发表于2020-04-17 15:24 被阅读0次

希望看完此文后,你对自己Swift继续保持信心

一、 协议 Protocol

  • ExpressibleByDictionaryLiteral
  • Sequence
  • Collection
  • CustomStringConvertible
  • Hashable Codable
  • Comparable
  • RangeReplaceableCollection

以上协议常见应用场景是什么,有什么作用?

二、@propertyWrapper

阅读以下代码,print 输出什么

    @propertyWrapper
    struct Wrapper<T> {
        var wrappedValue: T

        var projectedValue: Wrapper<T> { return self }

        func foo() { print("Foo") }
    }
    struct HasWrapper {
        @Wrapper var x = 0
    
        func foo() {
            print(x) // `wrappedValue`
            print(_x) // wrapper type itself
            print($x) // `projectedValue`
        }
    }

三、关键字

  • public open final
  • static class
  • mutating inout
  • infix operator
  • dynamicMemberLookup
  • where
  • @dynamicCallable
  • @autoclosure
  • @escaping

以上关键字使用场景是什么?

四、高阶函数

  • Filter, Map, Reduce, flatmap, compactMap

有何异同?

五、其他

  • 柯里化 什么意思
  • POPOOP的区别
  • AnyAnyObject 区别
  • rethrowsthrows 有什么区别呢?
  • break return continue fallthough 在语句中的含义(switch、while、for)

最后,欢迎各位神仙解答!

👇推荐👇:

大家可以加入iOS技术交流群,群号:789143298 群内提供数据结构与算法、底层进阶、swift、逆向、底层面试题整合文档等免费资料!!!

作者:四次元口袋

相关文章

网友评论

    本文标题:一文鉴定是Swift的王者,还是青铜

    本文链接:https://www.haomeiwen.com/subject/auhyvhtx.html