The elements to use as members of the new set. 新しい集合の要素として使うための要素。
Generic Initializer
init(_:)
Creates a new set from a finite sequence of items.
いくつかの要素からなる有限のシーケンスから集合を作成します。
Availability
- iOS 8.0+
- iPadOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 10.2+
Technology
- Swift Standard Library Swift標準ライブラリ
Declaration 宣言
Parameters パラメータ
sequence
Discussion 解説
Use this initializer to create a new set from an existing sequence, like an array or a range: このイニシャライザを使って、新しい集合を既存のシーケンス、配列またはある範囲などから作成してください:
let validIndices = Set(0..<7).subtracting([2, 4, 5])
print(validIndices)
// Prints "[6, 0, 1, 3]"