func insert(JSONEncoder.OutputFormatting) -> ( inserted: Bool, memberAfterInsert : JSONEncoder.OutputFormatting)
func update(with: JSONEncoder.OutputFormatting) -> JSONEncoder.OutputFormatting?
Availability 有効性
Technology
@discardableResult mutating func remove(_ member: JSONEncoder
.OutputFormatting
) -> JSONEncoder
.OutputFormatting
?
member
The element of the set to remove. 除去されることになる集合の要素。
The intersection of [member]
and the set, if the intersection was nonempty; otherwise, nil
.
[member]
とこの集合の交叉、その交叉が空でなかったならば;そうでなければ、nil
。
In the following example, the .priority
shipping option is removed from the options
option set. Attempting to remove the same shipping option a second time results in nil
, because options
no longer contains .priority
as a member.
以下の例において、.priority
出荷オプションは、options
オプションセットから除去されます。同じ出荷オプションの除去を2回目に試みることはnil
という結果になります、options
はもはや.priority
をメンバとして含まないからです。
var options: ShippingOptions = [.secondDay, .priority]
let priorityOption = options.remove(.priority)
print(priorityOption == .priority)
// Prints "true"
print(options.remove(.priority))
// Prints "nil"
In the next example, the .express
element is passed to remove(_:)
. Although .express
is not a member of options
, .express
subsumes the remaining .second
element of the option set. Therefore, options
is emptied and the intersection between .express
and options
is returned.
次の例では、.express
要素がremove(_:)
に渡されます。とは言え.express
はoptions
のメンバではありません、しかし.express
はこのオプションセットの残りの要素.second
を包含します。したがって、options
は空にされて.express
とoptions
の間の交叉が返されます。
let expressOption = options.remove(.express)
print(expressOption == .express)
// Prints "false"
print(expressOption == .secondDay)
// Prints "true"
func insert(JSONEncoder.OutputFormatting) -> ( inserted: Bool, memberAfterInsert : JSONEncoder.OutputFormatting)
func update(with: JSONEncoder.OutputFormatting) -> JSONEncoder.OutputFormatting?