I have an array of strings that contain numbers i.e. Shift 1 RT9909 I sort the array as follows:
NSSet *forms = dataObject.rtForms;
NSSortDescriptor *nameDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"type" ascending:YES];
NSArray *sorted = [forms sortedArrayUsingDescriptors:[NSArray arrayWithObject:nameDescriptor]];
This works fine while the number of elements is under 10. After this point Shift 10 RT9909 is placed in front Shift 2 RT9909.
So my question is how can I sort the array so that Shift 10 RT9909 would follow Shift 9 RT9909
NSArray *sorted = [forms sortedArrayUsingComparator:^NSComparisonResult(rtFormClass _Nonnull form1, rtFormClass * _Nonnull form2) { return [form1.type compare:form2.type options:NSNumericSearch];? UseNSNumericSearchto compare.