Home > DeveloperSection > Forums > AddObject as NSMutableArray in swift
Kamlakar Singh
Kamlakar Singh

Total Post:194

Posted on    October-18-2014 12:30 AM

 iPhone iPhone  Ios 

 1 Reply(s)
 7050  View(s)
Rate this:
I want to addObject of NSMutableArray into NSMutableArray so how can I achieve this in swift. and also retrieve it so please help me because right now I'm learning swift.

Indirectly say that I want 2D array means NSMutableArray of NSMutableArray.

//The below 2 lines iterative!
var dict:NSMutableDictionary? = NSMutableDictionary();

// and below 2 line is execute after complete the above iteration

//after that the above whole process is done iterative.

Pawan Shukla

Total Post:37

Posted on    October-18-2014 12:32 AM

If I am not wrong you want to add an object of NSMutableArray in another NSMutableArray you can do it by following code

var myArray : NSMutableArray = ["Hello"]
var arrayOfArray : NSMutableArray = [myArray]

// Insert more arrays with insertObject or addObject

arrayOfArray.insertObject(myArray, atIndex: 0)

var newArray:NSMutableArray = arrayOfArray[0] as NSMutableArray

Don't want to miss updates? Please click the below button!

Follow MindStick