Instance Method インスタンスメソッド

union(_:)

Returns a new option set of the elements contained in this set, in the given set, or in both. このセットの中に、与えられたセットの中に、または両方の中に、含まれる要素からなる新しいオプションセットを返します。

Declaration 宣言

Parameters パラメータ

other

An option set. あるオプションセット。

Return Value 戻り値

A new option set made up of the elements contained in this set, in other, or in both. この集合の中に、otherの中に、または両方の中に含まれる要素から作り上げられるオプションセット。

Discussion 議論

This example uses the union(_:) method to add two more shipping options to the default set. この例は、union(_:)メソッドを使って2つのさらなる出荷オプションを省略時のセットに加えます。


let defaultShipping = ShippingOptions.standard
let memberShipping = defaultShipping.union([.secondDay, .priority])
print(memberShipping.contains(.priority))
// Prints "true"