Yes, I know the title seems a bit to obvious, and can easily be searched for the solution. I know how to convert a 1-D NSArray to an Array, that is simple enough.
However, that is not my issue, as my NSArray is different. Please see the following code
NSArray *artists;
artists = @[@"Performed by: Legendary Group", @"Performed by: Ivan Cheong",
@"Performed by: Tien Nguyen", @"", @[@"Performed by: DJ Happee From
Channel 3.3", @"Performed by: Adam Cease", @""],
@"Performed by: Music Between California and Summer", @""];
Then in cellForRowAtIndexPath, I was about to access it like so:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
if ( [ [artists[indexPath.section] objectAtIndex:indexPath.row]
isEqualToString:@""] )
{
....
}
}
As you can clearly see, my NSArray contains another array at index 4. I require this for trivial purposes.
I would like to know is it possible to convert my NSArray to a Swift standard Array type?
I have tried to implement the equivalent:
var temp = NSArray()
let artists = ["Performed by: Legendary Group", "Performed by: Ivan Cheong",
"Performed by: Tien Nguyen", "", ["Performed by: DJ Happee From
Channel 3.3", "Performed by: Adam Cease", ""], "Performed by: Music
Between California and Summer", ""]
temp = artists
This works properly as I want, however, this is not up to Swift 2.0's coding standards.
I want to use an Array, but I don't know if this is possible?
Thanks