##宣言の書き方
let emojis = ["🍽","🍎","🍧","🍻","🏋️♀️","👔","💇🏻♂️","🧻","🏝","🏡","🌟","🚰","🚌","🚗","📱","📚","🏥","🏪"]
var days:[String] = []
var moneys:[Int16:String] = [:]
var arrayFloats: Array<Float> = Array()
指定要素分を固定値で初期化
Array(repeating: 初期値, count: 要素数)
var myArray = Array(repeating: 0, count: 3)
結果:
[0,0,0]
##配列要素の追加
emojis.append("m")
emojis += ["m"]
##配列を結合する
let s: String = emojis.joined()
let s: String = emojis.joined(separator: "-")
##Sort
let s = emojis.sorted()
emojis.sort()
//複雑な配列の場合
struct Person {
var name: String
var sex:Bool
}
var users = [...]
users.sort {$0.name < $1.name}