# Attributes for the Apple SDK

Set channel and contact attributes as key-value pairs for personalization.

For information about Attributes, including overview, use cases, and how to target Attributes, see [About Attributes](https://www.airship.com/docs/guides/audience/attributes/about/).

## Channel Attributes

Channel attributes are attributes managed on the Channel by the SDK.


#### Swift


```swift
Airship.channel.editAttributes { editor in
    editor.set(string: "Bobby's Phone", attribute: "device_name")
    editor.set(number: 4.99, attribute: "average_rating")
    editor.remove("vip_status")
}
```



#### Objective-C


```objc
[UAirship.channel editAttributes:^(UAAttributesEditor * editor) {
    [editor setString:@"Bobby's Phone" attribute:@"device_name"];
    [editor setNumber:@(4.99) attribute:@"average_rating"];
    [editor removeAttribute:@"vip_status"];
}];
```




## Contact Attributes

Contact attributes are attributes managed on the Contact by the SDK.


#### Swift


```swift
Airship.contact.editAttributes { editor in
    editor.set(string: "Bobby", attribute: "first_name")
}
```



#### Objective-C


```objc
[UAirship.contact editAttributes:^(UAAttributesEditor * editor) {
    [editor setString:@"Bobby" attribute:@"first_name"];
}];
```




## JSON Attributes

JSON Attributes are data objects containing one or more string, number, date, or boolean key-value pairs.

You can set and remove JSON Attributes on a Channel or a Contact. 


#### Swift


```swift
Airship.contact.editAttributes { editor in
    try! editor.set(
        json: [
            "key": .string("value"),
            "another_key": .string("another_value")
        ],
        attribute: "attribute_name",
        instanceID: "instance_id",
        expiration: Date.now
    )
}
```



## Verifying Attributes

To verify that attributes have been set correctly, look up the channel or contact in the [Contact Management](https://www.airship.com/docs/guides/audience/contact-management/) view. You can search by Channel ID or Named User ID to view the attributes associated with a channel or contact.

