A set of the same type as the current set. 現在の集合と同じ型の集合。
Instance Method
インスタンスメソッド
form
formUnion(_:)
Adds the elements of the given set to the set.
与えられた集合の要素をこの集合に加えます。
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
- tvOS 15.0+
- watchOS 8.0+
Technology
- Swift
UI
Declaration 宣言
mutating func formUnion(_ other: AccessibilityTechnologies
)
Parameters パラメータ
other
Discussion 議論
In the following example, the elements of the visitors
set are added to the attendees
set:
var attendees: Set = ["Alicia", "Bethany", "Diana"]
let visitors: Set = ["Diana", "Marcia", "Nathaniel"]
attendees.formUnion(visitors)
print(attendees)
// Prints "["Diana", "Nathaniel", "Bethany", "Alicia", "Marcia"]"
If the set already contains one or more elements that are also in other
, the existing members are kept.
var initialIndices = Set(0..<5)
initialIndices.formUnion([2, 3, 6, 7])
print(initialIndices)
// Prints "[2, 4, 6, 7, 0, 1, 3]"