Check out example codes for "register for remote notifications swift". It will help you in understanding the concepts better.

Code Example 1

// Import the UserNotifications framework and add the UNUserNotificationCenterDelegate in AppDelegate.swift
import UserNotifications 

// Request user permission

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        let center = UNUserNotificationCenter.current()
        center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
            // Enable or disable features based on authorization.
        return true

// Getting device token

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

    let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})

// In case of error

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

        print("i am not available in simulator \(error)")

// In case if you need to know the permissions granted

UNUserNotificationCenter.current().getNotificationSettings(){ (settings) in

	switch settings.soundSetting{
      	case .enabled:
	      	print("enabled sound setting")
		case .disabled:
      		print("setting has been disabled")
      	case .notSupported:
      		print("something vital went wrong here")

Learn ReactJs, React Native from