I have been googled, but have not been able to know what is faster to react faster: .
This is the only thing I can get (), but it is not relevant in my case because it is investigating the existence of the representative, I do not have any representative, I just see this I want to know whether the new API is present or not, on the device and if not back in the previous version of the API.
As mentioned, in the swift most of the time you ? What requirements can you get with
Optional App opporter operator ? This allows you to call a method on the object if and only then the object exists (no zero
) and the method is applied.
In the situation where you still need responder:
, it is still in the form of part of the NSObject
protocol.
If you are answering to : Tousselector:
Type A in an ob-swift, then it works just as you would expect. If you are using it on your own SWIFT class, you will need to make sure that your class comes out of NSObject
.
Here is an example of a swift class that you can check whether the answer is for a selector:
class worker: NSObject {func work () { } Func eat (food: AnyObject) {} func sleep (hours: int, minutes: int) {}} to the worker = worker () let doWork = worker.sundesToSelector (selector ("work")) Are = worker Choosing the respondents (Selector ("eat:")) / Come true, let's sleep = the worker.selected option (selector ("sleep: minute:")) // come true canQuit = worker.sundesToSelector ("left" ")) // false
It is important that you do not leave the parameter name. In this example, the selector ("sleep ::")
no as selector ("sleep: minutes:")
.
Comments
Post a Comment