Swift Types

From PeformIQ Upgrade
Jump to navigation Jump to search

Converting Arrays

if latitudeAll.count > 0 {
    let double = NSNumberFormatter().numberFromString(latitudeAll[0])?.doubleValue
}

if you want to convert a Double Array from String array:

 var doubleArray =  latitudeAll.map { Double($0) }

Note, doubleArray is type of [Double?]