{"id":18347305,"url":"https://github.com/pchelnikov/pluggableappdelegate","last_synced_at":"2025-04-06T08:33:51.652Z","repository":{"id":55505121,"uuid":"143058963","full_name":"pchelnikov/PluggableAppDelegate","owner":"pchelnikov","description":"!! No longer supported !! A lightweight service-oriented AppDelegate for iOS, made in Swift.","archived":false,"fork":false,"pushed_at":"2020-12-25T21:53:15.000Z","size":37,"stargazers_count":109,"open_issues_count":7,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T21:11:22.052Z","etag":null,"topics":["appdelegate","carthage","cocoapods","swift","swift5","uiapplicationdelegate","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pchelnikov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-31T19:35:54.000Z","updated_at":"2025-03-03T04:20:01.000Z","dependencies_parsed_at":"2022-08-15T02:00:37.411Z","dependency_job_id":null,"html_url":"https://github.com/pchelnikov/PluggableAppDelegate","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchelnikov%2FPluggableAppDelegate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchelnikov%2FPluggableAppDelegate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchelnikov%2FPluggableAppDelegate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchelnikov%2FPluggableAppDelegate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pchelnikov","download_url":"https://codeload.github.com/pchelnikov/PluggableAppDelegate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457572,"owners_count":20941902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appdelegate","carthage","cocoapods","swift","swift5","uiapplicationdelegate","xcode"],"created_at":"2024-11-05T21:13:39.964Z","updated_at":"2025-04-06T08:33:51.336Z","avatar_url":"https://github.com/pchelnikov.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PluggableAppDelegate\n\n[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/pchelnikov/PluggableAppDelegate/blob/master/LICENSE)\n[![Platform](https://img.shields.io/cocoapods/p/PluggableAppDelegate.svg?style=flat)](https://github.com/pchelnikov/PluggableAppDelegate)\n[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/PluggableAppDelegate.svg)](https://cocoapods.org/pods/PluggableAppDelegate)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n[![Twitter](https://img.shields.io/badge/Twitter-@pchelnikov-blue.svg?style=flat)](http://twitter.com/pchelnikov)\n\nA lightweight service-oriented ApplicationDelegate for iOS, made in Swift. Based on the Fernando Martín Ortiz's [idea](https://github.com/fmo91/PluggableApplicationDelegate) (**his repo not supported now**).\n\n`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.\n\nUsing `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`.\n\n## Requirements\n\n- iOS 9.0+\n- Xcode 10.2+\n- Swift 5.0\n\n## Usage\n\nHere is how a `ApplicationService` is like:\n\n```swift\nimport Foundation\n\nimport PluggableAppDelegate\n\nfinal class LoggerApplicationService: NSObject, ApplicationService {\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -\u003e Bool {\n        print(\"🎉 LoggerApplicationService has started!\")\n        return true\n    }\n\n    func applicationDidEnterBackground(_ application: UIApplication) {\n        print(\"🙀 LoggerApplicationService has entered background\")\n    }\n\n    func applicationWillEnterForeground(_ application: UIApplication) {\n        print(\"😻 LoggerApplicationService has entered foreground\")\n    }\n}\n```\n\nThat's all. **It is exactly the same as a AppDelegate**. Think of `ApplicationService` as sub-AppDelegates.\n\nIn `AppDelegate` you just have to inherit from PluggableApplicationDelegate to register the services.\n\n```swift\nimport UIKit\n\nimport PluggableAppDelegate\n\n@UIApplicationMain\nclass AppDelegate: PluggableApplicationDelegate {\n\n    override var services: [ApplicationService] {\n        return [\n            RootVCApplicationService(),\n            LoggerApplicationService()\n        ]\n    }\n}\n```\n\n## Installation\n\n### CocoaPods\n\nYou can use [CocoaPods](http://cocoapods.org/?q=MarkerKit).\n\n```bash\nplatform :ios, '9.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n  pod 'PluggableAppDelegate'\nend\n```\n\n#### Carthage \nYou can use [Carthage](https://github.com/Carthage/Carthage).\nSpecify in Cartfile:\n\n```bash\ngithub \"pchelnikov/PluggableAppDelegate\"\n```\n\nRun `carthage` to build the framework and drag the built MarkerKit.framework into your Xcode project. Follow [build instructions](https://github.com/Carthage/Carthage#getting-started).\n\n## Contribution\n\n- If you found a bug, [open an issue](https://github.com/pchelnikov/PluggableAppDelegate/issues)\n- If you have a feature request, [create pull request](https://github.com/pchelnikov/PluggableAppDelegate/pulls)\n\n## Author\n\nMichael Pchelnikov\n\nYou can follow me on Twitter at [@pchelnikov](http://twitter.com/pchelnikov)\n\n## Credits\n\n[Fernando Martín Ortiz](https://github.com/fmo91)\n\n## License\n\nPluggableAppDelegate is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpchelnikov%2Fpluggableappdelegate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpchelnikov%2Fpluggableappdelegate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpchelnikov%2Fpluggableappdelegate/lists"}