Tuplas en Swift - Desarrolladores iOS: Desde Objective-C hasta Swift

Blog sobre Optimizacion Avanzado y Desarrolladores iOS: Desde Objective-C hasta Swift en Estados Unidos

Las tuplas agrupan valores múltiples en un único valor compuesto. Los valores dentro de una tupla pueden ser de cualquier tipo y no tiene que ser del mismo tipo entre ellos.

let person = ("Gabriel", "Kirkpatrick")print(person.0) // Gabriel

También puedes darle nombre a los elementos de tuplas individuales:

let person = (first: "Gabriel", last: "Kirkpatrick")print(person.first)

Las tuplas son extremadamente convenientes como tipos de regreso para funciones que necesitan regresar más de un valor:

func intDivision(a: Int, b: Int) -> (quotient: Int, remainder: Int){ return (a/b, a%b)}print(intDivision(11, 3)) // (3, 2)let result = intDivision(15, 4)print(result.remainder) // 3

 

Visitar articulo completo sobre Desarrolladores iOS: Desde Objective-C hasta Swift

Comparte tu opinion o comenta

Cuenta tu opinion o amplia el contenido del articulo
Enviado por khadim hussain 04/11/2019
http://www.aiobjectives.com worldwide.Technology, especially artificial intelligence has made our lives really easy. From the general apps to Alexa in our houses technology has seeped in even without us realizing when this happened. Here is a quick view of future where AI will have significant role in each phase of our life.Android is a mobile operating system based on a modified version of the Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets. ... These apps are licensed by manufacturers of Android devices certified under imposed by Google
Enviado por khadim hussain 04/11/2019
http://www.aiobjectives.com worldwide.Technology, especially artificial intelligence has made our lives really easy. From the general apps to Alexa in our houses technology has seeped in even without us realizing when this happened. Here is a quick view of future where AI will have significant role in each phase of our life.Android is a mobile operating system based on a modified version of the Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets. ... These apps are licensed by manufacturers of Android devices certified under imposed by Google