初始化器
init()
创建一个空集。
必需的。提供默认实现。
声明
init()
详述
此初始化程序等效于使用空数组字面量进行初始化。例如,您使用此初始化程序或空数组文字创建一个空的 Set
实例。
var emptySet = Set<Int>()
print(emptySet.isEmpty)
// Prints "true"
emptySet = []
print(emptySet.isEmpty)
// Prints "true"
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相关用法
- Swift SetAlgebra init(_:)用法及代码示例
- Swift SetAlgebra insert(_:)用法及代码示例
- Swift SetAlgebra intersection(_:)用法及代码示例
- Swift SetAlgebra isStrictSubset(of:)用法及代码示例
- Swift SetAlgebra isDisjoint(with:)用法及代码示例
- Swift SetAlgebra isSubset(of:)用法及代码示例
- Swift SetAlgebra isStrictSuperset(of:)用法及代码示例
- Swift SetAlgebra isSuperset(of:)用法及代码示例
- Swift SetAlgebra remove(_:)用法及代码示例
- Swift SetAlgebra symmetricDifference(_:)用法及代码示例
- Swift SetAlgebra subtract(_:)用法及代码示例
- Swift SetAlgebra contains(_:)用法及代码示例
- Swift SetAlgebra formUnion(_:)用法及代码示例
- Swift SetAlgebra formSymmetricDifference(_:)用法及代码示例
- Swift SetAlgebra update(with:)用法及代码示例
- Swift SetAlgebra union(_:)用法及代码示例
- Swift SetAlgebra subtracting(_:)用法及代码示例
- Swift SetAlgebra formIntersection(_:)用法及代码示例
- Swift Set subtracting(_:)用法及代码示例
- Swift Set remove(_:)用法及代码示例
- Swift Set prefix(upTo:)用法及代码示例
- Swift Set subscript(_:)用法及代码示例
- Swift Set.Index ...(_:_:)用法及代码示例
- Swift Set update(with:)用法及代码示例
- Swift Set formIntersection(_:)用法及代码示例
注:本文由纯净天空筛选整理自apple.com大神的英文原创作品 SetAlgebra init()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。