初始化器
init(integer
init(integerLiteral:)
创建一个初始化为指定整数值的实例。
声明
init(integerLiteral value: Self)
当
Self
符合 _ExpressibleByBuiltinIntegerLiteral
时可用。参数
value
要创造的值。
详述
不要直接调用此初始化程序。相反,使用整数文字初始化变量或常量。例如:
let x = 23
在此示例中,对 x
常量的赋值会在后台调用此整数文字初始化程序。
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相关用法
- Swift Int8 init(truncatingIfNeeded:)用法及代码示例
- Swift Int8 init(exactly:)用法及代码示例
- Swift Int8 init(_:radix:)用法及代码示例
- Swift Int8 init(clamping:)用法及代码示例
- Swift Int8 init(_:)用法及代码示例
- Swift Int8 ~(_:)用法及代码示例
- Swift Int8 *=(_:_:)用法及代码示例
- Swift Int8 -(_:_:)用法及代码示例
- Swift Int8 %(_:_:)用法及代码示例
- Swift Int8 |=(_:_:)用法及代码示例
- Swift Int8 ...(_:_:)用法及代码示例
- Swift Int8 >>(_:_:)用法及代码示例
- Swift Int8 /(_:_:)用法及代码示例
- Swift Int8 ==(_:_:)用法及代码示例
- Swift Int8 |(_:_:)用法及代码示例
- Swift Int8 magnitude用法及代码示例
- Swift Int8 <<=(_:_:)用法及代码示例
- Swift Int8 &(_:_:)用法及代码示例
- Swift Int8 trailingZeroBitCount用法及代码示例
- Swift Int8 &+(_:_:)用法及代码示例
- Swift Int8 ...(_:)用法及代码示例
- Swift Int8 >>=(_:_:)用法及代码示例
- Swift Int8 &<<=(_:_:)用法及代码示例
- Swift Int8 &<<(_:_:)用法及代码示例
- Swift Int8 random(in:)用法及代码示例
注:本文由纯净天空筛选整理自apple.com大神的英文原创作品 Int8 init(integerLiteral:)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。