I am trying to go back and forth with different simple objective-c projects and port them to swift.
In objective-c, I have the following loop.
NSCountedSet *firstSet = [[NSCountedSet alloc] init];
NSCountedSet *secondSet = [[NSCountedSet alloc] init];
for(int i = 0; i < firstString.length; i++) {
[firstSet addObject:@([firstString characterAtIndex:i])];
[secondSet addObject:@([theSecondString characterAtIndex:i])];
}
I am attempting to port it to swift, but cannot figure out the addObject methodology
let firstSet = NSCountedSet()
let secondSet = NSCountedSet()
let lengthOfFirstString = firstString.utf16Count
for var i = 0; i < lengthOfFirstString; i++ {
}
Help on this would be appreciated