Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

return multiple values from a function swift

func returnMultipleValues() -> (String, Int, Double) {
    return ("Swift Tuple", 12, 3.14)
}

//Calling Function
let result = returnMultipleValues()

let nameString = result.0
let intValue = result.1
let doubleValue = result.2
Source by www.simpleswiftguide.com #
 
PREVIOUS NEXT
Tagged: #return #multiple #values #function #swift
ADD COMMENT
Topic
Name
8+5 =