Skip to content

Initializer

init(floatLiteral:)

Creates an instance initialized to the specified floating-point value.
init(floatLiteral value: FloatLiteralType)

Parameters

value

The value to create.

Discussion

Do not call this initializer directly. Instead, initialize a variable or constant using a floating-point literal. For example:

let x = 21.5

In this example, the assignment to the x constant calls this floating-point literal initializer behind the scenes.