Default keyword in Swift parameter

When reading the initializer for a NSLocalizedString I see that some of the parameters are defaulted to a value default. What does the default keyword represent?

func NSLocalizedString(key: String, tableName: String? = default, bundle: NSBundle = default, value: String = default, #comment: String) -> String

Solution 1:

This is not a valid Swift code, it's generated on the fly.

The default here means that there is some default value but the generator cannot visualize it right for you to see it. The default value is technically an inlined function, therefore it cannot be easily converted to a simple declaration.

You can see similar declarations for assert

func assert(condition: @auto_closure () -> Bool,
            _ message: StaticString = default,
                 file: StaticString = default,
                 line: UWord = default)

Where file defaults to #file (__FILE__ in Swift 1.x) and line defaults to #line (__LINE__ in Swift 1.x).

In the case of NSLocalizedString, the default value is "Localizable", referencing the default localization file Localizable.strings.