这是我试图实现的目标:
let a = CLLocation(latitude: 10, longitude: 20)
let b = CLLocation(latitude: 10, longitude: 40)
let c = CLLocation(latitude: 10, longitude: 60)
let d = CLLocation(latitude: 10, longitude: 80)
let aa = [a, b]
let bb = [c, d]
let zero = CLLocation(latitude: 0, longitude: 0)
let cc = [aa, bb].joined(separator: zero)
我需要这样的东西:
let output = [a, b, zero, c, d]
传递给不带参数的调用的参数
答案 0 :(得分:2)
分隔符也必须是数组:
let cc = [aa, bb].joined(separator: [zero])
print(Array(cc))