Skip to content

Instantly share code, notes, and snippets.

@IslamRustamov
Created June 7, 2023 20:01
Show Gist options
  • Save IslamRustamov/aedc2622cacc2047df59afd448fb30cb to your computer and use it in GitHub Desktop.
Save IslamRustamov/aedc2622cacc2047df59afd448fb30cb to your computer and use it in GitHub Desktop.
- (void)sort:(NSMutableArray *)arr resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
NSMutableArray <NSNumber *>*foo = [[NSMutableArray alloc] initWithArray:arr copyItems:YES];
for (int i = 0; i < [foo count]; i++) {
for (int j = 0; j < [foo count] - 1; j++) {
if (foo[j + 1].integerValue < foo[j].integerValue) {
NSInteger a = foo[j].integerValue;
foo[j] = foo[j + 1];
foo[j + 1] = @(a);
}
}
}
resolve(foo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment