Swift 'NSArray?' does not have a member named 'count'
I'm pretty sure it .count
returns the length of the array, but for some reason when I used it, it threw a weird error.
Here is my code:
let dataFile = NSBundle.mainBundle().pathForResource(RopeDataFile, ofType: nil)
let ropes = NSArray(contentsOfFile: dataFile!);
for i in 0..<ropes.count {
}
RopeDataFile
is the property list constant I made earlier.
For some reason, it gives this error on ropes.count
,
'NSArray? does not have a member named 'count'.
I'm new to quick and pathetic if the problem is really simple.
+3
source to share
2 answers