11.8 Selectors

A Selector in Objective-C can be seen as an equivalent to a procedural type in Object Pascal.

In difference with the procedural type, Objective-C has only 1 selector type: SEL. It is defined in the objc unit - which is automatically included in the uses clause of any unit compiled with the objectivec1 modeswitch.

To assign a value to a variable of type SEL, the objcselector method must be used:

{$modeswitch objectivec1}  
var  
  a: SEL;  
begin  
  a:=objcselector(’initiWithWidth:andHeight:’);  
  a:=objcselector(’myMethod’);  
end.

The objc unit contains methods to manipulate and use the selector.