{"id":22679824,"url":"https://github.com/provir/appreports","last_synced_at":"2025-08-16T13:54:16.999Z","repository":{"id":56902232,"uuid":"111259263","full_name":"ProVir/AppReports","owner":"ProVir","description":"Reports events and errors helper framework","archived":false,"fork":false,"pushed_at":"2019-03-28T20:20:16.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-15T01:21:53.580Z","etag":null,"topics":[],"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/ProVir.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":"2017-11-19T02:54:09.000Z","updated_at":"2019-03-28T20:19:09.000Z","dependencies_parsed_at":"2022-08-21T02:50:54.245Z","dependency_job_id":null,"html_url":"https://github.com/ProVir/AppReports","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProVir%2FAppReports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProVir%2FAppReports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProVir%2FAppReports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProVir%2FAppReports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProVir","download_url":"https://codeload.github.com/ProVir/AppReports/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246193156,"owners_count":20738450,"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":[],"created_at":"2024-12-09T19:10:58.130Z","updated_at":"2025-03-29T13:42:39.709Z","avatar_url":"https://github.com/ProVir.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ProVir AppReports\n\n[![CocoaPods Compatible](https://cocoapod-badges.herokuapp.com/v/AppReports/badge.png)](http://cocoapods.org/pods/AppReports)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/ProVir/AppReports)\n[![Platform](https://cocoapod-badges.herokuapp.com/p/AppReports/badge.png)](http://cocoapods.org/pods/AppReports)\n[![License](https://cocoapod-badges.herokuapp.com/l/AppReports/badge.png)](https://github.com/ProVir/AppReports/blob/master/LICENSE)\n\nReports events and errors helper framework.\nWrite and use for swift.\nYou can write helper on swift with support objc as wrapper for this class.\n\nThis framework is safe thread.\n\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Author](#author)\n- [License](#license)\n\n\n## Features\n\n- [x] General layout for reports event with custom type.\n- [x] General layout for reports errors.\n\n\n## Requirements\n\n- iOS 8.0+\n- Xcode 10.2\n- Swift 5.0\n\n\n## Communication\n\n- If you **need help**, go to [provir.ru](http://provir.ru)\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n\u003e CocoaPods 1.6.0+ is required to build AppReports 1.0.0+.\n\nTo integrate AppReports into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n\ntarget '\u003cYour Target Name\u003e' do\n  pod 'AppReports', '~\u003e 1.0'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate AppReports into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"ProVir/AppReports\" ~\u003e 1.0\n```\n\nRun `carthage update` to build the framework and drag the built `AppReports.framework` into your Xcode project.\n\n\n\n### Manually\n\nIf you prefer not to use any of the aforementioned dependency managers, you can integrate ProVirAppReports into your project manually.\n\nCopy files from directory `AppReports` in your project.\n\n\n---\n\n\n## Usage\n\nTo use the framework, you need:\n1. Use alias or inherit from `AppReportsCore` (logs, but without errors and events),  `AppReportsGenericError` (logs and errors only) or `AppReportsGeneric` (full - logs, errors and events).\n2. If you need to send errors, create your own type for errors or use the ready-made struct of `AppReportsErrorData`.\n3. If you need to send events, create your own type for events. Usually this is enum or struct.\n4. Perform `AppReportsCore.setup()` with parameters of the created you class or alias AppReports.\n\n**Note:** To use the library, remember to include it in each file: `import AppReports`.\n\n\n#### An example Helper for AppReports (Optional):\n```swift\nimport Crashlytics\nimport AppReports\n\nprivate class AppReportsHelper: AppReportsCoreHelper {\n\n    func logAdded(_ newStr: String, currentLog: String) {\n        //Crashlytics\n        CLSLogv(\"%@\", getVaList([newStr]))\n    }\n\n    func additionalValuesChanged(key: String, newValue: Any?, currentDict: [String : Any]) {\n        Crashlytics.sharedInstance().setValue(newValue, forKey: key)\n    }\n}\n```\n\n#### An example AppReportErrorsDestionation with AppReportsErrorData as Type Error Data:\n```swift\nimport Crashlytics\nimport AppReports\n\n\nclass AppReportsFabricErrors: AppReportErrorsDestionation\u003cAppReportsErrorData\u003e {\n    override func reportError(appReport: AppReportsCore, data: AppReportsErrorData, logs: String, additionalValues: [String : Any]) {\n\n        if let error = data.error {\n            Crashlytics.sharedInstance().recordError(error, withAdditionalUserInfo: data.userInfo)\n        }\n    }\n}\n```\n\n\n#### An example AppReportEventsDestionation with Custom Type Event Data:\n```swift\nimport Fabric\nimport AppReports\n\nenum AppReportsEvent {\n\n    enum SubEventOne {\n        case one\n        case two\n    }\n\n    enum SubEventTwo {\n        case one\n        case two\n    }\n\n    case oneType(SubEventOne)\n    case twoType(SubEventTwo)\n    case threeType(String)\n    case fourType\n}\n\n\n\n\nclass AppReportsFabricEvents: AppReportEventsDestionation\u003cAppReportsEvent\u003e {\n    override func reportEvent(appReport: AppReportsCore, data: AppReportsEvent, additionalValues: [String : Any]) {\n        let eventName:String\n\n        switch data {\n        case .oneType(let subEvent):\n            switch subEvent {\n            case .one:\n                eventName = \"One.one\"\n\n            case .two:\n                .....\n            }\n\n            ...\n        }\n\n        Answers.logCustomEvent(withName: eventName, customAttributes: additionalValues)\n    }\n}\n```\n\n\n\n#### An example Setup AppReports:\n```swift\nimport AppReports\n\ntypealias AppReports = AppReportsGeneric\u003cAppReportsEvent, AppReportsErrorData\u003e\n\nextension AppReportsGeneric where TypeEventData == AppReportsEvent, TypeErrorData == AppReportsErrorData {\n\n    static func createAppReports() {\n        let helper = AppReportsHelper()\n\n        setup(AppReports(settings: AppReportsCore.SettingsCore(),\n                         helper: helper,\n                         eventsDestionations: [AppReportsFabricEvents()],\n                         errorsDestionations: [AppReportsFabricErrors]))\n    }\n\n    static var shared:AppReports {\n        if let instance = coreShared as? AppReports {\n            return instance\n        } else {\n            createAppReports()\n            return coreShared as! AppReports\n        }\n    }\n}\n```\n\n#### An example use AppReports:\n```swift\nimport AppReports\n\nfunc testLogs() {\n    AppReports.log(\"Test log\")\n}\n\nfunc testEvent() {\n    AppReports.shared.reportEvent(.oneType(.one))\n}\n\nfunc testError(_ error:Error) {\n    AppReports.shared.reportError(error)\n}\n```\n\n\n\n## Author\n\n[**ViR (Короткий Виталий)**](http://provir.ru)\n\n\n## License\n\nProVir AppReports is released under the MIT license. [See LICENSE](https://github.com/ProVir/AppReports/blob/master/LICENSE) for details.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprovir%2Fappreports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprovir%2Fappreports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprovir%2Fappreports/lists"}