Parsowanie, aby podwoić dowolny typ danych w Swift
let lessPrecisePI = Float("3.14")
let morePrecisePI = Double("3.1415926536")
let width = CGFloat(Double("200.0")!)
Ankur
let lessPrecisePI = Float("3.14")
let morePrecisePI = Double("3.1415926536")
let width = CGFloat(Double("200.0")!)
if let cost = Double(textField.text!) {
print("The item is valued at: \(cost)")
} else {
print("Not a valid number: \(textField.text!)")
}
let wholeNumber = Int("27")
let smallInt = Int16("34")
let largeInt = Int64("39384")