Posted On: Dec 17, 2020
In swift, tuples are used to group multiple values into a single by using parentheses and separated by commas. It enables you to create, store, and pass around groups of values that can be of different types by using a single variable. It is needed to define those values with named variables or unnamed variables.
For instance, a simple example of defining named tuples in the swift programming language is as follows:
let user_info = (name: "Suresh Dasari", id: 200) Or var user_info:(name:String, id:Int) = ("Suresh Dasari", 200)
A simple example of defining unnamed tuples in the swift programming language is as follows:
let userInfo = ("Suresh Dasari", 200) Or var userinfo:(String, Int) = ("Suresh Dasari", 200)
Never Miss an Articles from us.
SwiftUI is a framework to build User Interfaces (UI) for iOS apps entirely with Swift code, using a novel declarative approach. Take Free : IOS Swift MCQ Exam...
The high order functions in swift are as followsMap Filter Sorted Reduce Chaining Contains AllSatisfy RemoveAll CompactMap FirstIndex and LastIndex ...
In Objective-C, the self is a special variable, in an instance method that refers to the receiver (object) of the message as well as invoking the method, while in a class method the self will indicate...