Swift 如何将数组位置数组与零位置联接?
这就是我努力实现的目标:Swift 如何将数组位置数组与零位置联接?,swift,core-location,Swift,Core Location,这就是我努力实现的目标: 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 =
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]
传递给不带参数的调用的参数
分隔符也必须是数组:
let cc = [aa, bb].joined(separator: [zero])
print(Array(cc))
更具体地说,传递给joined的值必须与数组中的类型相同,在本例中为[CLLocation]。是否尝试:让cc=[aa,bb]。joinedseparator:[zero]