Upvote:3

Aprove answer
NSMutableArray *originalArray = [self arrayFromCloudKit]; // fetch from CloudKit

// now the user wants it sorted alphabetically 
NSMutableArray *alphabeticallySorted = originalArray.mutableCopy
[alphabeticallySortedsortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
[self storeOriginalArray:originalArray];
[self displayUIWithArray:alphabeticallySorted];

// but if the user changes their mind, you just fetch the original and delete the sorted
NSMutableArray *originalArray = [self getOriginalArray];
[self displayUIWithArray:originalArray];

Credit Goes to: stackoverflow.com

Related question with same questions but different answers