Swiftpack.co - urbanairship/ios-library as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by urbanairship.
urbanairship/ios-library v2.0.0
Urban Airship iOS SDK
⭐️ 476
🕓 6 days ago
iOS macOS tvOS
.package(url: "https://github.com/urbanairship/ios-library.git", from: "v2.0.0")

Airship iOS SDK

The Airship SDK for iOS provides a simple way to integrate Airship services into your iOS applications.



Xcode 13.0+ is required to use the Airship SDK.


Make sure you have the CocoaPods dependency manager installed. You can do so by executing the following command:

$ gem install cocoapods

The primary Airship pod includes the standard feature set and is advisable to use for most use cases. The standard feature set includes Push, Actions, In-App Automation, and Message Center

Example podfile:

# Airship SDK
target "<Your Target Name>" do
  pod 'Airship'

The Airship pod also contains several subspecs that can be installed independently and in combination with one another when only a particular selection of functionality is desired:

  • Airship/Core : Push messaging features including channels, tags, named user and default actions
  • Airship/MessageCenter : Message center
  • Airship/Automation : Automation and in-app messaging
  • Airship/Location : Location including geofencing and beacons
  • Airship/ExtendedActions : Extended actions
  • Airship/PreferenceCenter : Preference center
  • Airship/Chat : Live chat

Example podfile:

target "<Your Target Name>" do
  pod 'Airship/Core'
  pod 'Airship/MessageCenter'
  pod 'Airship/Automation'

Install using the following command:

$ pod install

In order to take advantage of notification attachments, you will need to create a notification service extension alongside your main application. Most of the work is already done for you, but since this involves creating a new target there are a few additional steps. First create a new "Notification Service Extension" target. Then add AirshipExtensions/NotificationService to the new target:

# Airship SDK
target "<Your Service Extension Target Name>" do
  pod 'AirshipServiceExtension'

Install using the following command:

$ pod install

Then delete all the dummy source code for the new extension and have it inherit from UANotificationServiceExtension:

import AirshipServiceExtension

class NotificationService: UANotificationServiceExtension {


Other Installation Methods

For other installation methods, see the - Getting started guide.


An Important Note about Location

In Spring 2019, Apple began rejecting applications that use, or appear to use, Core Location services without supplying usage descriptions in their Info.plist files. In Airship SDK 11, all references to CoreLocation have been removed from the core library and placed in a separate location framework. Developers with no need for location services can continue to use Airship as before, but for those who have been using the UALocation class, see the Location sections for updated setup instructions.


As of SDK 10.2 and Apple's current App Store review policies, apps building against Airship without location usage descriptions in Info.plist are likely to be rejected. The easiest way to avoid this, if location services are not needed, is to use Airship SDK 11 or greater. If building against previous Airship SDKs, you will need to add add usage description strings to your Info.plist file under the NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription, and NSLocationAlwaysAndWhenInUseUsageDescription keys.


Enable Push Notifications and Remote Notifications Background mode under the capabilities section for the main application target.

Adding an Airship Config File

The library uses a .plist configuration file named AirshipConfig.plist to manage your production and development application profiles. Example copies of this file are available in all of the sample projects. Place this file in your project and set the following values to the ones in your application at http://go.urbanairship.com. To view all the possible keys and values, see the Config class reference

You can also edit the file as plain-text:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <string>Your Development App Key</string>
      <string>Your Development App Secret</string>
      <string>Your Production App Key</string>
      <string>Your Production App Secret</string>

The library will auto-detect the production mode when setting detectProvisioningMode to true.

Advanced users may add scripting or preprocessing logic to this .plist file to automate the switch from development to production keys based on the build type.

Call Takeoff

To enable push notifications, you will need to make several additions to your application delegate.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    Airship.takeOff(launchOptions: launchOptions)

    return true

To enable push later on in your application:

    // Somewhere in the app, this will enable push (setting it to NO will disable push,
    // which will trigger the proper registration or de-registration code in the library).
    Airship.push.userPushNotificationsEnabled = true

SDK Development

Make sure you have the CocoaPods dependency manager installed. You can do so by executing the following command:

$ gem install cocoapods

Install the pods:

$ pod install

Open Airship.xcworkspace

$ open Airship.xcworkspace

Update the Samples AirshipConfig by copyingAirshipConfig.plist.sample to AirshipConfig.plist and update the app's credentials. You should now be able to build, run tests, and run the samples.

The distribution can be generated by running the build.sh script:


Continuous integration will run scripts/run_ci_tasks.sh for every PR submitted.


Stars: 476
Last commit: 6 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2 weeks ago

Patch release that fixes a regression introduced in 16.11.0 that disables Survey's submit button and inputs, and added accessibility font scaling to Scenes & Surveys.


  • Scale fonts for Scenes & Surveys
  • Fixed Survey enablement regression

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics