[Swift]unionでセットを結合するサンプル

書式
セット1.union(セット2)
使用例

let cityA = Set(arrayLiteral: "Tokyo", "Oosaka", "Fukuoka","Yokohama")
let cityB = Set(["111", "222", "333"])

print(cityA.union(cityB))

結果
$ swift uniontest.swift
[“222", “Tokyo", “333", “Yokohama", “Fukuoka", “111", “Oosaka"]

Swift

Posted by arkgame