swift init array code example
Example 1: how to obtain array in array in swift
import UIKit
var str = "Hello, playground"
var setOfQuestion = ["q1","q2","q3","q4","q5"]
var setOfAnswers = ["A1","A2","A3","A4","A5"]
var setOfImages = ["Img1","Img2","Img3","Img4","Img5"]
var setOfArray = [[1,2,3,4],[5,6,7,8],[9,10,11],[12,13,14],[15,16]]
var setOfArrays = [setOfQuestion,setOfAnswers,setOfImages,setOfArray] as [Any]
for n in 0...3{
let x = n
print(setOfArrays as [[Any]0+x][0])
}
Example 2: array swift
var students = ["Ben", "Ivy", "Jordell"]
Example 3: swift initialize array with size
let myArraySize: Int = 42
let myArray: [Int] = [Int](repeating: 0, count: myArraySize)