Property with type SEL in Objective-c
I'd like to declare a property with type SEL
like this:
@property (nonatomic, assign) SEL mySelector;
Is "assign
" correct here? Perhaps assign
can be omitted?
Solution 1:
assign is the correct annotation here. You use assign for any primitive types. The alternatives (weak, strong/retain) rely on the property pointing at an object to function. I believe the compiler won't even let you declare the wrong type of property for this. If you really wanted to you could omit the assign as it is the default.