---
schema_version: "1"
id: c344d99ec13acbb114f3ca117d93e6a3a64eb0e652d2a07c0c80aaa18461a55e
title: CustomEvent
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud-mobilepush/engagement_sdk/references/ios-sdk-v11/sfmc-sdk/classes/customevent.md
canonical_url: https://developer.salesforce.com/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/customevent.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 25e5a909c90acd9293ff0ee20f65ca7eee00bfcdeb83e25fd10994b4c2864022
products:
  - Salesforce Engagement SDK
---
# CustomEvent

`Class`

## Declaration

```swift
@objc(SFMCSdkCustomEvent)
public final class CustomEvent : NSObject, UserEvent

public let id: String

public let name: String

public let category: EventCategory

public let attributes: [String : Any]?

public let userId: String?

@objc
public let priority: CustomEventPriority

@objc
public convenience init?(name: String, attributes: [String : Any]? = nil)
```

## Cases

### `id`

```swift
public let id: String
```

---

### `name`

```swift
public let name: String
```

---

### `category`

```swift
public let category: EventCategory
```

---

### `attributes`

```swift
public let attributes: [String : Any]?
```

---

### `userId`

```swift
public let userId: String?
```

---

### `priority`

Priority for this custom event (default: low). Read-only; can be used by MAM and other modules for handling. Only SFMCSDK can set this when creating events.

```swift
@objc
public let priority: CustomEventPriority
```

---

### `init(name:attributes:)`

Creates a custom event with the given name and optional attributes. Priority is always low when using this initializer.

```swift
@objc
public convenience init?(name: String, attributes: [String : Any]? = nil)
```

---
