SwiftName & NonSwiftName

The SwiftName aspect can be applied to methods in non-Swift (Oxygene, C# and Java) code to provide an alternative, more Swifty name for the method that will be visible to Swift users, in line with the Grand Rename or the Objective-C NS_SWIFT_NAME attribute:

[SwiftName('add(_ , key:)']
method addObject(aObject: not nullable Object) withKey(aKey: not nullable String);
[SwiftName("add(, key:)")]
public void addObject(object! obj) withKey(string! key);
@SwiftName("add(, key:)")
public void addObject(Object! object) withKey(String! aKey);

In addition to simply providing a different set of name parts, it can also be used to give the name of the first parameter, a syntax not supported by Oxygene, C# and Java.

SwiftName can be applied to constructors, and it can be applied to static factory methods to turn them into Swift constructors. In both of these cases, the external method name specified in the attribute must be init.

In reverse, the NonSwiftName aspect can be applied to methods in Swift code, to provide an alternative name for Oxygene, C# and Java that is more in line with those languages' multi-part method names.

@NonSwiftName("addObject() withKey()")
public func add(_ object: Object, key: String)