Accessing properties of objects in an NSSet
I have an object called Contact. A Contact has a relationship with a set of PhoneNumber objects.

A phone number has a label and a value property (both NSString pointers).

How do I get a set of all the phone number labels for a given Contact?

Here is the code for what I want to do, but I think there must be an easier way:

    NSet *phoneNumbersSet = contact.phoneNumbers;
    NSArray *phoneNumbersArray = [phoneNumbersSet allObjects];
    NSMutableSet *phoneNumberLabelSet = [[NSMutableSet alloc] setWithCapacity:0];
    for (PhoneNumber* phoneNumber in phoneNumbersArray) {
       [phoneNumberLabelSet addObject:phoneNumber.label];
    }

    
Accessing properties of objects in an NSSet
===

I have an object called Contact. A Contact has a relationship with a set of PhoneNumber objects.

A phone number has a label and a value property (both NSString pointers).

How do I get a set of all the phone number labels for a given Contact?

Here is the code for what I want to do, but I think there must be an easier way:

    NSet *phoneNumbersSet = contact.phoneNumbers;
    NSArray *phoneNumbersArray = [phoneNumbersSet allObjects];
    NSMutableSet *phoneNumberLabelSet = [[NSMutableSet alloc] setWithCapacity:0];
    for (PhoneNumber* phoneNumber in phoneNumbersArray) {
       [phoneNumberLabelSet addObject:phoneNumber.label];
    }

    