Apple\'s documentation is quite clear about how Objective-C initialization methods get converted into Swift intializers:
The “init” prefix gets sliced
From what I've been able to figure out just by playing around, the following rules are used to convert factory methods to convenience initializers.
instancetype
or MyClassName *
The class name suffix (optionally followed by "With" like in the initWith
conversion) is stripped off and the rest of the method name is used for the first parameter, with the first letter lower-cased.
For example, the following conversions apply:
[MyClassName myClassNameWithObject:obj] → MyClassName(object: obj)
[MyClassname classNameWithObject:obj] → MyClassName(object: obj)
[MyClassName nameObject:obj] → MyClassName(object: obj)
Note: since those all map to the same swift initializer, only one will be available (generally the first one declared)