All Projects → pchelnikov → Pluggableappdelegate

pchelnikov / Pluggableappdelegate

Licence: mit
!! No longer supported !! A lightweight service-oriented AppDelegate for iOS, made in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Pluggableappdelegate

Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-6.25%)
Mutual labels:  xcode, cocoapods, carthage
Quiver
Validation, searching and filtering made easy for swift.
Stars: ✭ 27 (-71.87%)
Mutual labels:  xcode, cocoapods, carthage
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (+493.75%)
Mutual labels:  xcode, cocoapods, carthage
Stepslider
StepSlider its custom implementation of slider such as UISlider for preset integer values.
Stars: ✭ 391 (+307.29%)
Mutual labels:  xcode, cocoapods, carthage
Swiftymessenger
Swift toolkit for passing messages between iOS apps and extensions.
Stars: ✭ 48 (-50%)
Mutual labels:  xcode, cocoapods, carthage
Gradientcircularprogress
Customizable progress indicator library in Swift
Stars: ✭ 407 (+323.96%)
Mutual labels:  xcode, cocoapods, carthage
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (+744.79%)
Mutual labels:  xcode, cocoapods, carthage
Microfeatures Guidelines
📦📝 uFeatures guidelines
Stars: ✭ 315 (+228.13%)
Mutual labels:  xcode, cocoapods, carthage
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (+936.46%)
Mutual labels:  xcode, cocoapods, carthage
Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (+903.13%)
Mutual labels:  xcode, cocoapods, carthage
Restofire
Restofire is a protocol oriented networking client for Alamofire
Stars: ✭ 377 (+292.71%)
Mutual labels:  xcode, cocoapods, carthage
Corenavigation
📱📲 Navigate between view controllers with ease. 💫 🔜 More stable version (written in Swift 5) coming soon.
Stars: ✭ 69 (-28.12%)
Mutual labels:  xcode, cocoapods, carthage
Tbuiautotest
Generating UI test label automatically for iOS.
Stars: ✭ 333 (+246.88%)
Mutual labels:  xcode, cocoapods, carthage
Uitextfield Navigation
🏄‍♂️ UITextField-Navigation makes it easier to navigate between UITextFields and UITextViews
Stars: ✭ 436 (+354.17%)
Mutual labels:  xcode, cocoapods, carthage
Maplebacon
🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations
Stars: ✭ 322 (+235.42%)
Mutual labels:  xcode, cocoapods, carthage
Sidemenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.
Stars: ✭ 5,267 (+5386.46%)
Mutual labels:  xcode, cocoapods, carthage
Anyformatkit
Simple text formatting in Swift
Stars: ✭ 296 (+208.33%)
Mutual labels:  xcode, cocoapods, carthage
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+3214.58%)
Mutual labels:  xcode, cocoapods, carthage
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-67.71%)
Mutual labels:  xcode, cocoapods, carthage
Luautocompleteview
Highly configurable autocomplete view that is attachable to any UITextField
Stars: ✭ 55 (-42.71%)
Mutual labels:  xcode, cocoapods, carthage

PluggableAppDelegate

License Platform Cocoapods Compatible Carthage compatible

Twitter

A lightweight service-oriented ApplicationDelegate for iOS, made in Swift. Based on the Fernando Martín Ortiz's idea (his repo not supported now).

AppDelegate is a traditional example of bad code. Lots of lines of code that makes so much different things are put together in methods that are called within the application life cycle. But all of those concerns are over.

Using PluggableAppDelegate you separate AppDelegate from the services that you can plug to it. Each ApplicationService has its own life cycle that is shared with AppDelegate.

Requirements

  • iOS 9.0+
  • Xcode 10.2+
  • Swift 5.0

Usage

Here is how a ApplicationService is like:

import Foundation

import PluggableAppDelegate

final class LoggerApplicationService: NSObject, ApplicationService {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
        print("🎉 LoggerApplicationService has started!")
        return true
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        print("🙀 LoggerApplicationService has entered background")
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        print("😻 LoggerApplicationService has entered foreground")
    }
}

That's all. It is exactly the same as a AppDelegate. Think of ApplicationService as sub-AppDelegates.

In AppDelegate you just have to inherit from PluggableApplicationDelegate to register the services.

import UIKit

import PluggableAppDelegate

@UIApplicationMain
class AppDelegate: PluggableApplicationDelegate {

    override var services: [ApplicationService] {
        return [
            RootVCApplicationService(),
            LoggerApplicationService()
        ]
    }
}

Installation

CocoaPods

You can use CocoaPods.

platform :ios, '9.0'
use_frameworks!

target 'MyApp' do
  pod 'PluggableAppDelegate'
end

Carthage

You can use Carthage. Specify in Cartfile:

github "pchelnikov/PluggableAppDelegate"

Run carthage to build the framework and drag the built MarkerKit.framework into your Xcode project. Follow build instructions.

Contribution

Author

Michael Pchelnikov

You can follow me on Twitter at @pchelnikov

Credits

Fernando Martín Ortiz

License

PluggableAppDelegate is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].