Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

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
    //Not able to get array from arry
    print(setOfArrays as [[Any]0+x][0])

}
Comment

array swift

var students = ["Ben", "Ivy", "Jordell"]
Comment

Swift arrays

var colors = ["red", "blue"]
var moreColors: String[] = ["orange", "purple"] // explicit type
colors.append("green") // [red, blue, green]
colors += "yellow" // [red, blue, green, yellow]
colors += moreColors // [red, blue, green, yellow, orange, purple]

var days = ["mon", "thu"]
var firstDay = days[0] // mon
days.insert("tue", atIndex: 1) // [mon, tue, thu]
days[2] = "wed" // [mon, tue, wed]
days.removeAtIndex(0) // [tue, wed]
Comment

Create a Swift Array

// an array of integer type
var numbers : [Int] = [2, 4, 6, 8]

print("Array: (numbers)")
Comment

PREVIOUS NEXT
Code Example
Swift :: define enum swift 
Swift :: swift find difference between two arrays 
Swift :: navigationbar large title swift 
Swift :: swiftui 100 days 
Swift :: most frequent element in array swift 
Swift :: swift map array to dictionary 
Swift :: get height of navigation bar swift 
Swift :: activity indicator swiftui 
Swift :: how to covert a string into a float in swift 
Swift :: swift create custom button programmatically 
Swift :: white status bar swift 
Swift :: swift infinite while loop 
Swift :: swift create an empty array 
Swift :: swift array map to another array 
Swift :: how to recieve hex value from NSData swift 
Swift :: and or in swift 
Swift :: swiftui menu 
Swift :: swiftui line break text 
Swift :: swiftui refresh view 
Swift :: swift array in chunks 
Swift :: why launch screen changes appear after 1 day in ios swift 
Swift :: swiftui rectangle top corners radius 
Swift :: Swift Equatable Protocol 
Swift :: on edit input field provide default value if textfield get empty swift 
Swift :: weather api in ios swift 5 
Swift :: string swift 
Swift :: Swift Syntax of Nested Function 
Swift :: image preprocessing in python 
Swift :: Swift for Loop with Stride Function 
Ruby :: rails delete child on parent delete 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =