The SEL can be understood as a function pointer in C language.
The SEL and ID, and class, are all data types in OC, as int and float. SEL variables can store selector data. @selector can be used to obtain the selector of a method.
SEL Afun = @selector (somemethodname:::::);
Instance objects can invoke the Sel method by Performseletor methods.
Because in
In Setstr: A Objc_setassociatedobject method is used in the method, which has four parameters, namely, the source object, the key (because you may want to add many attributes), the associated object, and an associated policy.
The key that is used to mark which attribute is common has three ways of writing, but the code effect is the same, as follows:
Using static variable address unique invariant feature
1, static void *strkey = &strKey;
2, static NSString *strkey = @ "Strkey";
3, static char strkey;
Therefore, using the @selector (property name) is equivalent to generating a function pointer generated by the property name, which guarantees that the set and get methods can correspond to a unique key.