I tried to take a look at the Swift API for Int, and I'm still not sure why this works:
var foo = Int("100")
In the documentation, I see the following initializers:
init()
init(_: Builtin.Word)
init(_: Double)
init(_: Float)
init(_: Int)
init(_: Int16)
init(_: Int32)
init(_: Int64)
init(_: Int8)
init(_: UInt)
init(_: UInt16)
init(_: UInt32)
init(_: UInt64)
init(_: UInt8)
init(_:radix:)
init(_builtinIntegerLiteral:)
init(bigEndian:)
init(bitPattern:)
init(integerLiteral:)
init(littleEndian:)
init(truncatingBitPattern: Int64)
init(truncatingBitPattern: UInt64)
But I do not see init(_: String)
above. Is there any automation that happens under the hood?
source
share