didTimeOut is a selector. So is scheduledTimerWithTimeInterval(_:, target:, selector:, userInfo:, repeats:). It’s the signature of a function.
The problem it solves is this: when you write Selector("didTimeOut"), “didTimeOut” is a String. The compiler doesn’t test that String to check that it refers to a real function, so if you make a spelling mistake, you don’t find out about it until the program runs. #selector lets the compiler verify that you’re calling a real function, and that makes your code safer.
There are a handful. I don’t know them all and I haven’t used them much myself, but generally they’re ‘compiler’ messages in some fashion. A few were introduced with Swift 2.2 - for example, if you write this into a project: print("\(#file), \(#line)")
then when it runs it’ll print a message to the console, consisting of the file path of the file in which you wrote the statement, and the number of the line you wrote it on.
Another one is #available, which you can use to determine things like which operating system your code is being run on, and so only make use of a feature if you know it’s available to that operating system.