Swift Types

From PeformIQ Upgrade
Revision as of 20:54, 16 October 2021 by PeterHarding (talk | contribs) (Created page with " =Converting Arrays= <pre> if latitudeAll.count > 0 { let double = NSNumberFormatter().numberFromString(latitudeAll[0])?.doubleValue } </pre> if you want to convert a Do...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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?]