What's the advantage of #selector update in Swift 2.3?

后端 未结 3 1441
孤城傲影
孤城傲影 2021-01-19 00:53

I can\'t see a problem with just writing the method name as a string. Im just curious as to why this is better?

3条回答
  •  梦毁少年i
    2021-01-19 01:24

    “Before Swift 2.2, selectors were string literals and prone to error because we, as humans invented, and still contribute to typos whenever given the chance to write something without autocomplete.”

    https://medium.com/swift-programming/swift-selector-syntax-sugar-81c8a8b10df3#.8ki9dd38j

提交回复
热议问题