{"id":19943140,"url":"https://github.com/cats-oss/degu","last_synced_at":"2025-05-03T15:32:45.485Z","repository":{"id":56908372,"uuid":"139093708","full_name":"cats-oss/Degu","owner":"cats-oss","description":"🐭 Degu is debug utility for iOS, tvOS and macOS.","archived":false,"fork":false,"pushed_at":"2020-08-25T04:15:42.000Z","size":421,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-15T06:48:30.787Z","etag":null,"topics":["cocoapods","debugging-tool","ios","macos","swift","swift-package-manager","tvos"],"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/cats-oss.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-06-29T02:57:30.000Z","updated_at":"2020-04-20T13:41:35.000Z","dependencies_parsed_at":"2022-08-20T19:50:28.913Z","dependency_job_id":null,"html_url":"https://github.com/cats-oss/Degu","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cats-oss%2FDegu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cats-oss%2FDegu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cats-oss%2FDegu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cats-oss%2FDegu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cats-oss","download_url":"https://codeload.github.com/cats-oss/Degu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252211499,"owners_count":21712405,"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":["cocoapods","debugging-tool","ios","macos","swift","swift-package-manager","tvos"],"created_at":"2024-11-13T00:15:30.291Z","updated_at":"2025-05-03T15:32:45.025Z","avatar_url":"https://github.com/cats-oss.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./Images/degu_logo.png\" alt=\"DEGU\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Platforms-iOS%20%7C%20tvOS%20%7C%20macOS-blue.svg?style=flat\" alt=\"platforms\" /\u003e\n  \u003ca href=\"https://developer.apple.com/swift\"\u003e\n    \u003cimg src=\"http://img.shields.io/badge/Language-Swift5.1-orange.svg?style=flat\" alt=\"Swift4.1\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"./LICENSE\"\u003e\n    \u003cimg src=\"http://img.shields.io/badge/License-MIT-lightgray.svg?style=flat\" alt=\"License\" /\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\" alt=\"Carthage\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/apple/swift-package-manager\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/SwiftPM-compatible-4BC51D.svg?style=flat\" alt=\"SwiftPM\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"http://cocoapods.org/pods/Degu\"\u003e\n    \u003cimg src=\"https://img.shields.io/cocoapods/v/Degu.svg?style=flat\" alt=\"Version\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nIf you want to get all events of an application, you can get events from `UIApplication.sendEvent(_:)`. But, following implementations are needed to get events from it.\n\n```swift\n/* MyApplication.swift */\n\nclass MyApplication: UIApplication {\n    override sendEvent(_ event: UIEvent) {\n        super.sendEvent(event)\n        print(event)\n    }\n}\n```\n\n```swift\n/* main.swift */\n\nprivate let applicationClassName: String = {\n    #if DEBUG\n        return NSStringFromClass(MyApplication.self)\n    #else\n        return NSStringFromClass(UIApplication.self)\n    #endif\n}()\n\nUIApplicationMain(\n    CommandLine.argc,\n    UnsafeMutableRawPointer(CommandLine.unsafeArgv)\n        .bindMemory(\n            to: UnsafeMutablePointer\u003cInt8\u003e.self,\n            capacity: Int(CommandLine.argc)),\n    applicationClassName,\n    NSStringFromClass(AppDelegate.self)\n)\n```\n\n```swift\n/* AppDelegate.swift */\n\n// @UIApplicationMain \u003c- comment out\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    ...\n}\n```\n\n`Degu` makes them easy!!\n\n## Usage\n\n### 1. ApplicationProxy\n\nThis is an example. There are only 2 implementations what you have to.\n\n- set a delegate to `ApplicationProxy.shared.delegate`\n- implement `ApplicationProxyDelegate`\n\n```swift\nimport Degu\n\nclass AppDelegate: UIResponder, ApplicationDelegate {\n    ...\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -\u003e Bool {\n        // Override point for customization after application launch.\n\n        #if DEBUG\n        ApplicationProxy.shared.delegate = self\n        #endif\n\n        ...\n\n        return true\n    }\n\n    ...\n}\n\nextension AppDelegate: ApplicationProxyDelegate {\n    func applicationProxy(_ proxy: ApplicationProxy, didSendEvent event: UIEvent) {\n        print(event)\n    }\n}\n```\n\nIn addition, you can get lifecycle method call of all ViewControllers.\n\n```swift\nfunc applicationProxy(_ proxy: ApplicationProxy, didCallLifeCycle lifeCycle: ViewControllerLifeCycle, ofViewController viewController: UIViewController) {\n    print(\"ViewController = \\(viewController)\")\n    print(\"LifeCycle = \\(lifeCycle)\")\n}\n```\n\n### 2. Override load or initialize method\n\n[+(void)load](https://developer.apple.com/documentation/objectivec/nsobject/1418815-load) and [+(void)initialize](https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize) are not permitted by Swift.\n\n![](./Images/load.png)\n\n![](./Images/initialize.png)\n\nYou can override `+(void)load` and `+(void)initialize` in **Extension of RuntimeHandler**.\n\n```swift\nextension RuntimeHandler {\n    open override class func handleLoad() {\n        // do something\n    }\n\n    open override class func handleInitialize() {\n        // do something\n    }\n}\n```\n\n⚠️ `handleLoad` and `handleInitialize` are not called **Subclass of RuntimeHandler**. It only works in **Extension of RuntimeHandler**.\n\n## Installation\n\n### Carthage\n\nIf you’re using [Carthage](https://github.com/Carthage/Carthage), simply add Degu to your `Cartfile`:\n\n```\ngithub \"cats-oss/Degu\"\n```\n\n### CocoaPods\n\nDegu is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Degu'\n```\n\n### Swift Package Manager\n\nIf you’re using [Swift Package Manager](https://github.com/apple/swift-package-manager), simply add Degu to your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/cats-oss/Degu\", from: \"0.2.0\")\n]\n```\n\n## Requirements\n\n- Xcode 11.1\n- Swift 5.1\n\n## License\n\nDegu is available under the MIT license. See the [LICENSE file](https://github.com/cats-oss/Degu/blob/master/LICENSE) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcats-oss%2Fdegu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcats-oss%2Fdegu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcats-oss%2Fdegu/lists"}