Latest 0.9.0
Homepage https://github.com/square/SuperDelegate
License Apache License, Version 2.0
Platforms ios 8.0

CI Status
Carthage Compatibility
Version
License
Platform

SuperDelegate provides a clean application delegate interface and protects you from bugs in the application lifecycle.

Purpose

Consolidate tribal knowledge about and workarounds for eccentricities in the UIApplicationDelegate API contract.

Example: in iOS 8.4, application(_:handleWatchKitExtensionRequest:reply:) is called before application(_:didFinishLaunchingWithOptions:); this is not the case in iOS 8.0-8.3. SuperDelegate protects you against such changes in the API contract.

Create a clean UIApplicationDelegate API that meets your needs.

Example: application(_:didFinishLaunchingWithOptions:) and application(_:didReceiveRemoteNotification:fetchCompletionHandler:) will tell you when you receive a push notification (sometimes they tell you twice!), but they don’t differentiate between delivery due to a customer tapping on notification or delivery due to the content-available=1 flag being set in the APNS dictionary. SuperDelegate is designed to give you the information you need when you need it.

Installation

CocoaPods

To install SuperDelegate in your iOS project with CocoaPods, add the following to your Podfile:

platform :ios, '8.0'
pod 'SuperDelegate'

Carthage

To install SuperDelegate in your iOS project with Carthage, add the following to your Cartfile:

github "Square/SuperDelegate"

Run carthage to build the framework and drag the built SuperDelegate.framework into your Xcode project.

Swift Package Manager

To install SuperDelegate in your iOS project with Swift Package Manager, the following definition can be added to the dependencies of your Project:

  .Package(
    url: "https://github.com/square/SuperDelegate.git",
    versions: Version(0,8,0)..<Version(0,9,0)
  ),

Submodules

To use git submodules, checkout the submodule with git submodule add [email protected]:Square/SuperDelegate.git, drag SuperDelegate.xcodeproj to your project, and add SuperDelegate as a build dependency.

Getting Started

public class AppDelegate: SuperDelegate, ApplicationLaunched

Have your UIApplicationDelegate subclass SuperDelegate and conform to the ApplicationLaunched protocol. SuperDelegate guarantees to call setupApplication() only once per application launch, before making any other delegate calls. SuperDelegate also guarantees that loadInterfaceWithLaunchItem(_:) will be called once, when your app is brought to the foreground for the first time after it is launched.

Adopting more AppDelegate features

To opt into more AppDelegate features, have your AppDelegate class conform to the associated protocol. For example, making your AppDelegate class conform to LocalNotificationCapable will give your app the ability to post local notifications.

Requirements

  • Xcode 7.0 or later.
  • iOS 8 or later.

Versions

  • 0.8.* – Swift 2.3 and Xcode 7.3+. This version has been thouroughly vetted.
  • 0.9.* – Swift 3.0 and Beta Xcode 8. This version is in active development.
  • 1.0 – Will be released when iOS 10 is near release.

Contributing

We’re glad you’re interested in SuperDelegate, and we’d love to see where you take it. Please read our contributing guidelines prior to submitting a Pull Request.

Thanks, and happy delegating!

Latest podspec

{
    "name": "SuperDelegate",
    "version": "0.9.0",
    "license": "Apache License, Version 2.0",
    "summary": "SuperDelegate provides a clean application delegate interface and protects you from bugs in the application lifecycle.",
    "homepage": "https://github.com/square/SuperDelegate",
    "authors": "Square",
    "source": {
        "git": "https://github.com/square/SuperDelegate.git",
        "tag": "0.9.0"
    },
    "source_files": "Sources/*.swift",
    "platforms": {
        "ios": "8.0"
    }
}

Pin It on Pinterest

Share This