---
schema_version: "1"
id: c7475825e66ecf3529a049c4a2c1aac69b6ece63641b2baaca696640d1b00253
title: PushFeature
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/push-feature/classes/pushfeature.md
canonical_url: https://developer.salesforce.com/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/pushfeature.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 56e3cafaaec0a9a3fd1f3b0edcabad45f705af8deb1bf14d83394ef5beb4f601
products:
  - Salesforce Engagement SDK
---
# PushFeature

`Class`

The main API class of PushFeature module

## Declaration

```swift
@objc(SFPushFeature)
public final class PushFeature: NSObject,
                                SFMCModule,
                                Subscriber,
                                Publisher

@objc
public static func requestSdk(_ callback: @escaping (_ pushFeature: PushFeatureApi?) -> Void)

public func setDeviceToken(_ deviceToken: Data)

public func deviceToken() -> String?

public func setPushEnabled(pushEnabled: Bool)

public func isPushEnabled() -> Bool

public func setNotificationResponse(_ response: UNNotificationResponse)

public func notificationResponse() -> UNNotificationResponse?

public func setNotificationUserInfo(_ userInfo: [AnyHashable : Any])

public func notificationUserInfo() -> [AnyHashable : Any]

public func setURLHandlingDelegate(_ delegate: URLHandlingDelegate)
```

## Request SDK Method

### `requestSdk(_:)`

Requests the Push Feature Module when it’s operational and safe to use. The provided callback will be invoked with the Push Feature Module when it’s ready. All push feature module-related API calls should be made within this function.

```swift
@objc
public static func requestSdk(_ callback: @escaping (_ pushFeature: PushFeatureApi?) -> Void)
```

---

## Push Token Methods

### `setDeviceToken(_:)`

Responsible for sending the Apple device token back to all the subscribers. It marks the end of the token registration flow. If it is unable to reach Salesforce server, it will save the token and try again later. This method is necessary to the implementation of Salesforce Push.

```swift
public func setDeviceToken(_ deviceToken: Data)
```

---

### `deviceToken()`

Returns the device token as a String.

```swift
public func deviceToken() -> String?
```

---

## Feature Toggle Methods

### `setPushEnabled(pushEnabled:)`

Developer override to set the state of push enablement to true/false. If set to false, the application will not receive any push notifications once the Marketing Cloud server has been updated. When this value is false, it takes precedence (overrides) the user notifications settings (i.e., setting this to false will always disable push.) Conversely, if the user has notifications settings disabled, the developer cannot enable push via this method. A false value from either source (user settings or developer interface) always wins.

```swift
public func setPushEnabled(pushEnabled: Bool)
```

---

### `isPushEnabled()`

Combination of push enabled from user notifications settings and push enabled by sdk.

```swift
public func isPushEnabled() -> Bool
```

---

## PushNotification Methods

### `setNotificationResponse(_:)`

Informs the module of the current notification response when user clicks a notification.

```swift
public func setNotificationResponse(_ response: UNNotificationResponse)
```

---

### `notificationResponse()`

Returns the last notification response delivered to the module.

```swift
public func notificationResponse() -> UNNotificationResponse?
```

---

### `setNotificationUserInfo(_:)`

Informs the module of the current userInfo when user clicks a notification.

```swift
public func setNotificationUserInfo(_ userInfo: [AnyHashable : Any])
```

---

### `notificationUserInfo()`

Returns the user info of the last notification delivered to the module.

```swift
public func notificationUserInfo() -> [AnyHashable : Any]
```

---

## URLHandling

### `setURLHandlingDelegate(_:)`

Set URLHandling delegate to handle URLs in OpenDirect URLs, CloudPage URLs, CloudPage URLs from inbox messages.This value takes precedence over the config setting which is passed during the SDK initialization.

```swift
public func setURLHandlingDelegate(_ delegate: URLHandlingDelegate)
```

---
