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

Related tags

Tools SuperDelegate
Overview

DEPRECATED

This library has been deprecated and is no longer under active development. The original README can be found in README_OLD, but we would recommend moving away from using this library in the future.

If you still find this project useful and are interested in taking over maintenance of this project, please feel free to file an issue requesting transfer of ownership.

Comments
  • RemoteNotification should search for values in

    RemoteNotification should search for values in "aps" dictionary instead of top level.

    I'm not really sure about this, as I'm new to using remote notifications. But reading the documentation gives me the impression that the userInfo dictionary has an aps dictionary inside with the values.

    So the RemoteNotification's init should actually look more like this:

    public init?(remoteNotification: [NSObject : AnyObject]?) {
        guard let remoteNotification = remoteNotification as? [String : AnyObject] else {
            return nil
        }
    
        let apsKey = "aps"
        let aps = remoteNotification[apsKey] as? [String : AnyObject]
    
        alert = aps.flatMap(Alert.init(remoteNotification:))
        badge = aps?[badgeKey] as? Int
        sound = aps?[soundKey] as? String
        contentAvailable = aps?[contentAvailableKey] != nil
        categoryIdentifier = aps?[categoryKey] as? String
        remoteNotificationDictionary = remoteNotification
    
        var customFields = remoteNotification
        customFields.removeValueForKey(apsKey)
    
        userInfo = customFields
    }
    

    At least that seems to work for me, what do you think?

    bug 
    opened by NinoScript 9
  • Tapping on a notification in Notification Center while app in foreground but inactive doesn't return .UserTappedToBringAppToForeground

    Tapping on a notification in Notification Center while app in foreground but inactive doesn't return .UserTappedToBringAppToForeground

    If a notification is received when the app is not in foreground, the app is then launched, notification center is opened and a notification is tapped, the notificationOrigin is marked as .DeliveredWhileInForground.

    I noticed that in that case, the following is true: applicationIsInForeground && application.applicationState == .Inactive

    I propose that we look for that case and return .UserTappedToBringAppToForeground instead. Something like this:

        let notificationOrigin: UserNotificationOrigin
        if applicationIsInForeground {
            notificationOrigin = application.applicationState == .Inactive
                ? .UserTappedToBringAppToForeground
                : .DeliveredWhileInForground
        } else if application.applicationState == .Background && remoteNotification.contentAvailable {
            notificationOrigin = .DeliveredWhileInBackground
        } else {
            notificationOrigin = .UserTappedToBringAppToForeground
        }
    
    bug help wanted 
    opened by NinoScript 8
  • App Delegate Life Cycle Protocol

    App Delegate Life Cycle Protocol

    Hi. We are in need of the following delegate calls for analytics as well as some core data handling:

    Transitioning to the foreground:
    - applicationDidBecomeActive(_:)
    
    Transitioning to the background:
    - applicationDidEnterBackground(_:)
    
    Transitioning to the inactive state:
    - applicationWillResignActive(_:) (Called when leaving the foreground state.)
    - applicationWillEnterForeground(_:) (Called when transitioning out of the background state.)
    
    Termination:
    - applicationWillTerminate(_:) (Called only when the app is running. This method is not called if the app is suspended.)
    

    Hence, I propose some sort of LifeCycleProtocol, maybe LifeCycleAware, in order to retrieve those delegate calls.

    protocol LifeCycleAware {
      func transitionedToForeground()
      func transitionedToBackground()
    
      func transitioningToBackground()
      func transitioningToForeground()
    
      func terminatingApplication()
    }
    

    Cheers!

    opened by benjohnde 6
  • Build fails when integrating through Cocoapods

    Build fails when integrating through Cocoapods

    As mentioned in the title, building the app fails in file SuperDelegate+LocalNotifications.swift on line 22.

    Error: No such module 'UserNotifications'.

    My Podfile:

    platform :ios, '8.0'
    
    target 'NewProject' do
        use_frameworks!
        pod 'SuperDelegate'
    end
    

    Cocoapods version 1.0.1

    question 
    opened by gapl 6
  • Swift 3.0 and iOS 10 SDK adoption

    Swift 3.0 and iOS 10 SDK adoption

    This branch / pull request represents v0.9 of SuperDelegate. v0.9 is a breaking change from v0.8, and has the following new features:

    • Adoption of Swift 3.0
    • Adoption of Swift 3.0 naming conventions

    See issues for outstanding/known issues in v0.9.

    Contributing

    • Discovered a bug UIApplicationDelegate that we haven't addressed?
    • Want a feature that does not exist?
    • Found a bug?
    • Dislike our take on Swift 3.0 naming conventions?
    • Something else?

    We want to hear from you! Please follow our contributing guidelines by filing an issue before submitting a PR. If you have a comment on a line in this PR, please file an issue with a link to the line number. Thanks!

    opened by dfed 5
  • SuperDelegate should not contain test helpers

    SuperDelegate should not contain test helpers

    I suggest to move the method testing_resetAllData() from Sources to Tests. Without having deep dived into that, I guess that we could also add this functionality via extension :).

    opened by benjohnde 4
  • Optional protocol requirements

    Optional protocol requirements

    Any plans on using optional protocol requirements? Sometimes you only need one specific function to be invoked instead of all.

    Of course, you can easily ignore the others. But wouldn't it be nicer to just use the necessary protocol requirements a specific use case demands?

    opened by benjohnde 4
  • Add optional method that has unedited launchOptions?

    Add optional method that has unedited launchOptions?

    Unfortunately there's some SDK's that require the launchOptions directly. Maybe there could be an addition to have an optional protocol method that has these unedited launchOptions. I could not find any other built in work-around for this issue.

    question 
    opened by dcvz 2
  • Emphasize UIApplicationDelegate protocol requirements

    Emphasize UIApplicationDelegate protocol requirements

    Adjust sample project to emphasize UIApplicationDelegate protocol requirements.

    In the current example project window is defined as:

      let window = UIWindow()
    

    If I am using some libraries like SVProgressHUD which access the current UIWindow via the following selector UIApplication.shared.delegate?.window they all crash as this invocation returns nil.

    Hence, I propose to update the sample project to meet those protocol requirements.

    opened by benjohnde 1
  • Swift 4

    Swift 4

    It also worked before in our project, but as I am trying to help out regarding #3 and #5 I migrated my locally checked out project. Hence, here is small PR. The CLA was filled out beforehand.

    opened by benjohnde 1
  • [RFC][DNM] Swift 3.0 and iOS 10 SDK adoption

    [RFC][DNM] Swift 3.0 and iOS 10 SDK adoption

    This branch / pull request represents v0.9 of SuperDelegate. v0.9 is a breaking change from v0.8, and has the following new features:

    • Adoption of Swift 3.0 [RFC]
    • Adoption of Swift 3.0 naming conventions [RFC]
    • Adoption of iOS 10 SDK [in progress]

    See issues for outstanding/known issues in v0.9.

    Contributing

    • Discovered a bug UIApplicationDelegate that we haven't addressed?
    • Want a feature that does not exist?
    • Found a bug?
    • Dislike our take on Swift 3.0 naming conventions?
    • Something else?

    We want to hear from you! Please follow our contributing guidelines by filing an issue before submitting a PR. If you have a comment on a line in this PR, please file an issue with a link to the line number. Thanks!

    opened by dfed 1
  • Swift 4.2 support

    Swift 4.2 support

    Swift 4.2 introduced a bunch of churn around imported UIKit interfaces. The result is that SuperDelegate fails to build with Swift 4.2 entirely.

    I'm happy to do the work to update the library for 4.2, but before I do: how have these updates been handled in the past. Do we want to maintain backwards compatibility, or do we want to bump the version number and only support 4.2+?

    opened by gfontenot 2
  • Do not set UIWindow bounds

    Do not set UIWindow bounds

    Closes #14

    Just grabbed the low hanging fruit and adjusted the deployment target as well as the removal of settings the bounds to UIScreen.bounds programmatically.

    opened by benjohnde 2
  • Swift 4

    Swift 4

    It also worked before in our project, but as I am trying to help out regarding #3 and #5 I migrated my locally checked out project. Hence, here is small PR. The CLA was filled out beforehand.

    opened by benjohnde 1
  • setup(mainWindow:) shouldn't set UIWindow's bounds on iOS9+

    setup(mainWindow:) shouldn't set UIWindow's bounds on iOS9+

    When setting UIWindow's bounds to UIScreen.main.bounds it breaks apps on iPads with iOS 9 and higher. This is caused because of the multitasking feature introduced in iOS 9. Setting those bound make the app appear under the status bar. Having just makeKeyAndVisible results in correct behavior.

    opened by TadeasKriz 5
  • Should not need to re-request UserNotification permissions on every WillEnterForeground

    Should not need to re-request UserNotification permissions on every WillEnterForeground

    We should be able just use currentUserNotificationSettings. Not re-requesting will reduce noise on the API, and more over currentUserNotificationSettings is known to be more reliable than the notification settings passed down into application(_:didRegister:).

    Our re-request is a holdover from iOS 7, e.g the days before currentUserNotificationSettings existed.

    enhancement 
    opened by dfed 2
Releases(0.9.0)
Owner
Square
Square
Command line program that detects unused resource strings in an iOS or OS X application.

Abandoned Resource String Detection This command line program detects unused resource strings in an iOS or OS X application. Updated to Swift 3, thank

Josh Smith 360 Nov 26, 2022
All new design. Inspect your iOS application at runtime.

Peek: All new design Peek 5 with an all new design and all new features. Whether you're a developer, designer or QA/tester, Peek can help you at all s

Shaps 2.6k Dec 17, 2022
Automatically build and rebuild Xcode image catalogs for app icons, universal images, and more

Better asset workflow for iOS developers. Generate Xcode image catalogs for iOS / OSX app icons, universal images, and more.

Dotan J. Nahum 822 Dec 21, 2022
Build native iOS, Android, and Web apps with Capacitor and Remix.run 💿

This repository holds production ready Capacitor templates for building native mobile applications using Remix. Using Capacitor, you can quickly build out a native mobile application for iOS and Android using web technology, such as Remix.

Ionic 70 Dec 30, 2022
Swift CLI for strong-typing images, colors, storyboards, fonts and localizations

Shark Shark is a Swift command line tool that generates type safe enums for your images, colors, storyboards, fonts and localizations. Because Shark r

Kaan Dedeoglu 377 Dec 1, 2022
Strong typed, autocompleted resources like images, fonts and segues in Swift projects

R.swift Get strong typed, autocompleted resources like images, fonts and segues in Swift projects Why use this? It makes your code that uses resources

Mathijs Kadijk 8.9k Jan 6, 2023
Xcode storyboards diff and merge tool.

StoryboardMerge Storyboard diff and merge tool which: compares and merges two storyboard files, provides an automatic merge-facility, The storyboardin

null 238 Sep 12, 2022
An adorable little framework and command line tool for interacting with SourceKit.

SourceKitten An adorable little framework and command line tool for interacting with SourceKit. SourceKitten links and communicates with sourcekitd.fr

JP Simard 2.1k Jan 5, 2023
A SwiftUI implementation of React Hooks. Enhances reusability of stateful logic and gives state and lifecycle to function view.

SwiftUI Hooks A SwiftUI implementation of React Hooks. Enhances reusability of stateful logic and gives state and lifecycle to function view. Introduc

Ryo Aoyama 441 Jan 6, 2023
Everyone tries to implement a cache at some point in their iOS app’s lifecycle, and this is ours.

Everyone tries to implement a cache at some point in their app’s lifecycle, and this is ours. This is a library that allows people to cache NSData wit

Spotify 1.2k Dec 28, 2022
PJFDataSource is a small library that provides a simple, clean architecture for your app to manage its data sources while providing a consistent user interface for common content states (i.e. loading, loaded, empty, and error).

PJFDataSource PJFDataSource is a small library that provides a simple, clean architecture for your app to manage its data sources while providing a co

Square 88 Jun 30, 2022
Allow users to easily share Diagnostics with your support team to improve the flow of fixing bugs.

Example mail composer Example Report Diagnostics is a library written in Swift which makes it really easy to share Diagnostics Reports to your support

WeTransfer 768 Dec 22, 2022
Sample project displaying bugs in the StarSDK while using Kotlin Native

StarSampleSdk iOS Bugs that need to be reproduced Retrieving network printer status fails after subsequent attempts Star Bluetooth printer with an act

Bailey Pollard 1 Aug 18, 2022
A collection of bugs present in the SwiftUI beta.

Gosh Darn Bugs! GoshDarnBugs is a collection of... you guessed it, bugs. Usage Clone the repository. Open GoshDarnBugs.xcodeproj Click Run. Why? Swift

SwiftUIX 33 Aug 28, 2021
QR code detector. Simple usage, you can get recognition results via delegate or callback.

SPQRCode QR code detector. Simple usage, you can get recognition results via delegate or callback. Installation Swift Package Manager CocoaPods Manual

Sparrow Code 58 Jan 6, 2023
Cryptocurrency price checker, build with UIKit and MVC + Delegate pattern.

Coin Check Cryptocurrency price checker. The app fetch from CoinAPI.io the latest coin prices, build with UIKit and MVC + Delegate pattern. Features S

Anibal Ventura 0 Jan 10, 2022
A meta library to provide a better `Delegate` pattern.

Delegate A meta library to provide a better Delegate pattern described here and here. Usage Instead of a regular Apple's protocol-delegate pattern, us

Wei Wang 67 Dec 23, 2022
A wrapper around UICollectionViewController enabling a declarative API around it's delegate methods using protocols.

Thunder Collection Thunder Collection is a useful framework which enables quick and easy creation of collection views in iOS using a declarative appro

3 SIDED CUBE 4 Nov 6, 2022
This to learn such as : Add Target , NSNotification Center Send/Get Data , Observer Override , resize Data By Byte , UIImagePicker Delegate , UIAlert Handle , Top ViewController , Get pickerController

Technicalisto How to Create UIButton Class to Pick Data Image Purpose Learn this topics With exact Task Add Target NSNotification Center Send/Get Data

Aya Baghdadi 1 Feb 20, 2022