What is the difference between those two? What is Selector
, and what is #selector
?
Asked
Active
Viewed 1,833 times
5

Iulian Onofrei
- 9,188
- 10
- 67
- 113

Kyle Bing
- 179
- 1
- 18
-
See if this helps: https://medium.com/swift-programming/swift-selector-syntax-sugar-81c8a8b10df3 – Teodor Cristian Sep 06 '17 at 10:29
1 Answers
6
Both are same things, the purpose of #selector()
syntax is to save you from the possible error in having to write a selector as a literal string, which is error-prone.

Baig
- 4,737
- 1
- 32
- 47
-
2`Selector()` is old, only fill with String, can't check syntax error, but `#selector` is new, and it works like real class. – Kyle Bing Sep 06 '17 at 10:39