iOS/Objective-C

NSMutableArray

패쓰킴 2022. 11. 2. 16:24
728x90

중복 제거

NSMutableArray *_userIds = [NSMutableArray new];

for( NSInteger i = 0; i < 3; i++ ) {
  [_userIds insertObject:@"aaaaaaaaaa" atIndex:i];
}

NSOrderedSet *userSet = [[NSOrderedSet alloc] initWithArray:_userIds];
_userIds = [[NSMutableArray alloc] initWithArray:[userSet array]];

출처 : https://mrkn.tistory.com/337

728x90