---
metadata:
  - name: generator
    content: Diplodoc Platform v5.64.0
alternate:
  - https://appmetrica.yandex.by/docs/en/sdk/ios/analytics/swift/ProfileAttribute.md
  - https://appmetrica.yandex.by/docs/ru/sdk/ios/analytics/swift/ProfileAttribute.md
  - https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/ProfileAttribute.md
  - href: https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/ProfileAttribute.md
    type: text/markdown
    title: Markdown version
  - href: https://appmetrica.yandex.by/docs/zh/llms.txt?revision=r21920615
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://appmetrica.yandex.by/docs/zh/llms.txt?revision=r21920615

# ProfileAttribute 类

该类的方法创建预定义和自定义的个人档案属性。

AppMetrica 让您创建最多 100 个自定义属性。

## Instance methods {#instance_summary}

#|
|| [birthDate()](#method_birthDate) | 创建生日属性。 ||
|| [customBool(_:)](#method_customBool) | 创建一个自定义属性，类型为 `bool`。 ||
|| [customCounter(_:)](#method_customCounter) | 创建自定义属性，类型为标签。 ||
|| [自定义数字(_:)](#method_customNumber) | 创建一个自定义属性，使用`double`类型. ||
|| [customString(_:)](#method_customString) | 创建一个自定义属性，类型为 `string`。 ||
|| [gender()](#method_gender) | 创建性别属性。 ||
|| [name()](#method_name) | 创建一个名称属性。 ||
|| [notificationsEnabled()](#method_notificationsEnabled) | 创建通知状态属性。 ||
|#

## Method descriptions {#method_detail}

### birthDate() {#method_birthDate}

```swift translate=no
class func birthDate() -> BirthDateAttribute
```

创建生日属性。

{% note alert %}

AppMetrica不会在网页界面显示[预定义属性](https://appmetrica.yandex.by/docs/zh/data-collection/profile-attributes.md#pre-defined)，如果`ProfieId`发送未配置。

{% endnote %}

**返回：**

实现 [BirthDateAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/BirthDateAttribute.md) 协议的实例。

### customBool(_:) {#method_customBool}

```swift translate=no
class func customBool(_ name: String) -> CustomBoolAttribute
```

创建一个自定义属性，类型为 `bool`。

**参数：**

#|
|| `名称` | Attribute name. 该值最多可包含 200 个字符。 ||
|#

**返回：**

实现 [CustomBoolAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/CustomBoolAttribute.md) 协议的实例。

### customCounter(_:) {#method_customCounter}

```swift translate=no
class func customCounter(_ name: String) -> CustomCounterAttribute
```

创建自定义的计数器类型属性。

**参数：**

#|
|| `名称` | Attribute name. 该值最多可包含 200 个字符。 ||
|#

**返回：**

实现 [CustomCounterAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/CustomCounterAttribute.md) 协议的实例。

### customNumber(_:) {#method_customNumber}

```swift translate=no
class func customNumber(_ name: String) -> CustomNumberAttribute
```

创建一个带有 `double` 类型的自定义属性。

**参数：**

#|
|| `名称` | Attribute name. 该值最多可以包含 200 个字符。 ||
|#

**返回：**

实现 [CustomNumberAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/CustomNumberAttribute.md) 协议的实例。

### customString(_:) {#method_customString}

```swift translate=no
class func customString(_ name: String) -> CustomStringAttribute
```

创建一个自定义属性，类型为 `string`。

**参数：**

#|
|| `名称` | Attribute name. 该值最多可包含 200 个字符。 ||
|#

**返回：**

实现 [CustomStringAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/CustomStringAttribute.md) 协议的实例。

### gender() {#method_gender}

```swift translate=no
class func gender() -> GenderAttribute
```

创建性别属性。

{% note alert %}

AppMetrica不会在网页界面显示[预定义属性](https://appmetrica.yandex.by/docs/zh/data-collection/profile-attributes.md#pre-defined)，如果`ProfieId`发送未配置。

{% endnote %}

**返回：**

实现 [GenderAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/GenderAttribute.md) 协议的实例。

### name() {#method_name}

```swift translate=no
class func name() -> NameAttribute
```

创建名称属性。

{% note alert %}

AppMetrica不会在网页界面显示[预定义属性](https://appmetrica.yandex.by/docs/zh/data-collection/profile-attributes.md#pre-defined)，如果`ProfieId`发送未配置。

{% endnote %}

**返回：**

实现 [NameAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/NameAttribute.md) 协议的实例。

### notificationsEnabled() {#method_notificationsEnabled}

```swift translate=no
class func notificationsEnabled() -> NotificationsEnabledAttribute
```

创建 NotificationsEnabled 属性。

{% note alert %}

AppMetrica不会在网页界面显示[预定义属性](https://appmetrica.yandex.by/docs/zh/data-collection/profile-attributes.md#pre-defined)，如果`ProfieId`发送未配置。

{% endnote %}

**返回：**

实现 [NotificationsEnabledAttribute](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/swift/NotificationsEnabledAttribute.md) 协议的实例。
