{"id":13465953,"url":"https://github.com/yangKJ/RxNetworks","last_synced_at":"2025-03-25T21:30:57.158Z","repository":{"id":38249619,"uuid":"365455244","full_name":"yangKJ/RxNetworks","owner":"yangKJ","description":"🧚 MVP Network Api library. 插件版网络基础架构，支持响应式。","archived":false,"fork":false,"pushed_at":"2024-07-30T02:19:42.000Z","size":4226,"stargazers_count":224,"open_issues_count":1,"forks_count":50,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-09-02T14:44:04.504Z","etag":null,"topics":["api","cache","loading","moya","network","plugin","rxswift","token"],"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/yangKJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-08T08:01:09.000Z","updated_at":"2024-08-27T11:55:14.000Z","dependencies_parsed_at":"2022-08-09T01:31:16.228Z","dependency_job_id":"e65435c1-8fa6-46b7-8b6c-b5dcd6283017","html_url":"https://github.com/yangKJ/RxNetworks","commit_stats":{"total_commits":145,"total_committers":4,"mean_commits":36.25,"dds":"0.43448275862068964","last_synced_commit":"8f4cc5dd18c71fe10690be625f64ab3c6a7c2500"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FRxNetworks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FRxNetworks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FRxNetworks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FRxNetworks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yangKJ","download_url":"https://codeload.github.com/yangKJ/RxNetworks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222091696,"owners_count":16929683,"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":["api","cache","loading","moya","network","plugin","rxswift","token"],"created_at":"2024-07-31T15:00:37.280Z","updated_at":"2024-10-29T18:30:28.348Z","avatar_url":"https://github.com/yangKJ.png","language":"Swift","funding_links":["https://github.com/sponsors/yangKJ?frequency=one-time\u0026sponsor=yangKJ","https://www.buymeacoffee.com/yangkj3102"],"categories":["Libs","OOM-Leaks-Crash"],"sub_categories":["Network","Rx Series"],"readme":"# Booming\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://github.com/yangKJ/RxNetworks)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Booming.svg?style=flat\u0026label=Booming\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/Booming)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/RxNetworks.svg?style=flat\u0026label=RxNetworks\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/RxNetworks)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/HollowCodable.svg?style=flat\u0026label=HollowCodable\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/HollowCodable)\n![Platform](https://img.shields.io/badge/Platforms-iOS%20%7C%20macOS%20%7C%20watchOS-4E4E4E.svg?colorA=28a745)\n\n**[Booming](https://github.com/yangKJ/RxNetworks)** is a base network library for Swift. Developed for Swift 5, it aims to make use of the latest language features. The framework's ultimate goal is to enable easy networking that makes it easy to write well-maintainable code.\n\n**[RxNetworks](https://github.com/yangKJ/RxNetworks)** is a declarative and reactive networking library for Swift.\n\n\u003cfont color=red\u003e**🧚. RxSwift + Moya + HandyJSON / Codable + Plugins.👒👒👒**\u003c/font\u003e\n\n-------\n\nEnglish | [**简体中文**](README_CN.md)\n\nThis is a network api set of infrastructure based on Moya, also support responsive network with RxSwift.\n\n## Features\nAt the moment, the most important features of Booming can be summarized as follows:\n\n- [x] Support reactive network requests combined with [RxSwift](https://github.com/ReactiveX/RxSwift).\n- [x] Support for [OOP](https://github.com/yangKJ/RxNetworks/blob/master/Booming/NetworkAPIOO.swift) also support [POP](https://github.com/yangKJ/RxNetworks/blob/master/Booming/NetworkAPI.swift) network requests.\n- [x] Support data parsing with [HandyJSON](https://github.com/alibaba/HandyJSON) and [Codable](https://github.com/yangKJ/HollowCodable).\n- [x] Support simple customization of various network plugins for [Moya](https://github.com/Moya/Moya).\n- [x] Support uploading and downloading files or resources [plugin](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkFilesPlugin.swift).\n- [x] Support configuration of general request and path, general parameters, etc.\n- [x] Support for added default plugins with `BoomingSetup.basePlugins`.\n- [x] Support authorization certificate [plugin](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkAuthenticationPlugin.swift) with Alamofire [RequestInterceptor](https://github.com/Alamofire/Alamofire/blob/master/Source/Features/RequestInterceptor.swift).\n- [x] Support automatic managed [loading](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Huds/NetworkLoadingPlugin.swift) plugins hud.\n- [x] Support token [plugin](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkTokenPlugin.swift) validation and automatically retries new token requests.\n- [x] Support shared [plugin](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkSharedPlugin.swift) that do not request the same network repeatedly.\n- [x] Support separate plugin library, eg: [Loading](https://cocoapods.org/pods/NetworkHudsPlugin) / [AnimatedLoading](https://cocoapods.org/pods/NetworkLottiePlugin) / [Cache](https://cocoapods.org/pods/NetworkCachePlugin).\n- [x] Support 18 plugins have been packaged for you to use.\n\n### Usages\nHow to use [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md).\n\n```\nSharedAPI.userInfo(name: \"yangKJ\").request(successed: { response in\n    // do somthing..\n}, failed: { error in\n    print(error.localizedDescription)\n})\n\nor use async/await with swift 5.5\n\nTask {\n    do {\n        let response = try await LoadingAPI.test2(\"666\").requestAsync()\n        let json = response.bpm.mappedJson\n        // do somthing..\n        let model = LoadingModel.deserialize(from: json, designatedPath: \"data\")\n    } catch {\n        block(error.localizedDescription)\n    }\n}\n```\n\n### Plugins\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/NetworkHudsPlugin.svg?style=flat\u0026label=NetworkHudsPlugin\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/NetworkHudsPlugin)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/NetworkCachePlugin.svg?style=flat\u0026label=NetworkCachePlugin\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/NetworkCachePlugin)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/NetworkLottiePlugin.svg?style=flat\u0026label=NetworkLottiePlugin\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/NetworkLottiePlugin)\n\nThis module is mainly based on moya package network related plugins.\n\n- At present, 14 plugins have been packaged for you to use:\n    - [Header](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkHttpHeaderPlugin.swift): Network HTTP Header Plugin.\n    - [Authentication](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkAuthenticationPlugin.swift): Interceptor plugin.\n    - [Debugging](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkDebuggingPlugin.swift): Network printing, built in plugin.\n    - [GZip](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkGZipPlugin.swift): Network data unzip plugin.\n    - [Shared](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkSharedPlugin.swift): Network sharing plugin.\n    - [Files](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkFilesPlugin.swift): Network downloading files And Uploading resources plugin.\n    - [Token](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkTokenPlugin.swift): Token verify plugin.\n    - [Ignore](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkIgnorePlugin.swift): Ignore plugin, the purpose is to ignore a plugin in this network request.\n    - [CustomCache](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Features/NetworkCustomCachePlugin.swift): Custom network data caching plugin.\n    - [Cache](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Cache/NetworkCachePlugin.swift): Network data cache plugin.\n    - [Lottie](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Lottie/AnimatedLoadingPlugin.swift): Animation loading plugin based on lottie.\n    \nFor ios platform:    \n- [Loading](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Huds/NetworkLoadingPlugin.swift): Loading animation plugin.\n- [Warning](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Huds/NetworkWarningPlugin.swift): Network failure prompt plugin.\n- [Indicator](https://github.com/yangKJ/RxNetworks/blob/master/Plugins/Views/NetworkIndicatorPlugin.swift): Indicator plugin.\n\nIf you want to use token plugin and auth plugin you can refer to the project use case.    \n- [Auth](https://github.com/yangKJ/RxNetworks/blob/master/RxNetworks/Plugins/Auth/AuthPlugin.swift): Authorization plugin.\n\n🎷 Simple to use, implement the protocol method in the API protocol, and then add the plugin to it:\n\n```\nvar plugins: APIPlugins {\n    let cache = NetworkCachePlugin.init()\n    let loading = NetworkLoadingPlugin.init()\n    let warning = NetworkWarningPlugin.init()\n    let shared = NetworkSharedPlugin.init()\n    let gzip = NetworkGZipPlugin.init()\n    return [loading, cache, warning, shared, gzip]\n}\n```\n\n### RxSwift\nThis module mainly supports responsive data binding.\n\n```\nfunc request(_ count: Int) -\u003e Observable\u003c[CacheModel]\u003e {\n    CacheAPI.cache(count).request()\n        .deserialized(ApiResponse\u003c[CacheModel]\u003e.self)\n        .compactMap { $0.data }\n        .observe(on: MainScheduler.instance)\n        .catchAndReturn([])\n}\n```\n\n### HollowCodable\n**[HollowCodable](https://github.com/yangKJ/HollowCodable)** is a codable customization using property wrappers library for Swift.\n\nThis module is serialize and deserialize the data, Replace HandyJSON.\n\n🎷 Example of use in conjunction with the network part:\n\n```\nfunc request(_ count: Int) -\u003e Observable\u003c[LoadingModel]\u003e {\n    CodableAPI.cache(count)\n        .request(callbackQueue: DispatchQueue(label: \"request.codable\"))\n        .deserialized(ApiResponse\u003c[LoadingModel]\u003e.self)\n        .compactMap({ $0.data })\n        .observe(on: MainScheduler.instance)\n        .catchAndReturn([])\n}\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eRxSwift deserialized extension.\u003c/summary\u003e\n\n```swift\npublic extension Observable where Element: Any {\n    \n    @discardableResult func deserialized\u003cT\u003e(_ type: T.Type) -\u003e Observable\u003cT\u003e where T: HollowCodable {\n        return self.map { element -\u003e T in\n            return try T.deserialize(element: element)\n        }\n    }\n    \n    @discardableResult func deserialized\u003cT\u003e(_ type: [T].Type) -\u003e Observable\u003c[T]\u003e where T: HollowCodable {\n        return self.map { element -\u003e [T] in\n            return try [T].deserialize(element: element)\n        }\n    }\n    \n    @discardableResult func deserialized\u003cT\u003e(_ type: T.Type) -\u003e Observable\u003cApiResponse\u003cT.DataType\u003e\u003e where T: HasResponsable, T.DataType: HollowCodable {\n        return self.map { element -\u003e ApiResponse\u003cT.DataType\u003e in\n            return try T.deserialize(element: element)\n        }\n    }\n    \n    @discardableResult func deserialized\u003cT\u003e(_ type: T.Type) -\u003e Observable\u003cApiResponse\u003c[T.DataType.Element]\u003e\u003e where T: HasResponsable, T.DataType: Collection, T.DataType.Element: HollowCodable {\n        return self.map { element -\u003e ApiResponse\u003c[T.DataType.Element]\u003e in\n            return try T.deserialize(element: element)\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n### HandyJSON\n⚠️ Note: This module is not recommended because it has stopped maintenance.\n\n\u003cdetails\u003e\n  \u003csummary\u003eThis module is based on HandyJSON package network data parsing.\u003c/summary\u003e\n\n- Roughly divided into the following 3 parts:\n    - [HandyDataModel](https://github.com/yangKJ/RxNetworks/blob/master/Sources/HandyJSON/HandyDataModel.swift): Network outer data model.\n    - [HandyJSONError](https://github.com/yangKJ/RxNetworks/blob/master/Sources/HandyJSON/HandyJSONError.swift): Parse error related.\n    - [RxHandyJSON](https://github.com/yangKJ/RxNetworks/blob/master/Sources/HandyJSON/RxHandyJSON.swift): HandyJSON data parsing, currently provides two parsing solutions.\n\n🎷 Example of use in conjunction with the network part:\n\n```\nfunc request(_ count: Int) -\u003e Driver\u003c[CacheModel]\u003e {\n    CacheAPI.cache(count).request()\n        .asObservable()\n        .mapHandyJSON(HandyDataModel\u003c[CacheModel]\u003e.self)\n        .compactMap { $0.data }\n        .observe(on: MainScheduler.instance)\n        .delay(.seconds(1), scheduler: MainScheduler.instance)\n        .asDriver(onErrorJustReturn: [])\n}\n```\n\u003c/details\u003e\n\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile:\n\n```\npod 'Booming'\n```\n\nYou should define your minimum deployment target explicitly, like: \n\n```\nplatform :ios, '11.0'\n```\n\nIf you want import cache plugin:\n\n```\npod 'NetworkCachePlugin'\n```\n\nIf you want import loading plugin:\n\n```\npod 'NetworkHudsPlugin'\n```\n\nIf you wang using Codable:\n\n```\npod 'HollowCodable'\n```\n\nIf responsive networking is required:\n\n```\npod 'RxNetworks/RxSwift'\n```\n\nFor other plugins and modules excluded, please read the [podspec](https://github.com/yangKJ/RxNetworks/blob/master/Booming.podspec) file.\n\n### Remarks\n\n\u003e The general process is almost like this, the Demo is also written in great detail, you can check it out for yourself.🎷\n\u003e\n\u003e [**BoomingDemo**](https://github.com/yangKJ/RxNetworks)\n\u003e\n\u003e Tip: If you find it helpful, please help me with a star. If you have any questions or needs, you can also issue.\n\u003e\n\u003e Thanks.🎇\n\n### About the author\n- 🎷 **E-mail address: [yangkj310@gmail.com](yangkj310@gmail.com) 🎷**\n- 🎸 **GitHub address: [yangKJ](https://github.com/yangKJ) 🎸**\n\nBuy me a coffee or support me on [GitHub](https://github.com/sponsors/yangKJ?frequency=one-time\u0026sponsor=yangKJ).\n\n\u003ca href=\"https://www.buymeacoffee.com/yangkj3102\"\u003e\n\u003cimg width=25% alt=\"yellow-button\" src=\"https://user-images.githubusercontent.com/1888355/146226808-eb2e9ee0-c6bd-44a2-a330-3bbc8a6244cf.png\"\u003e\n\u003c/a\u003e\n\nAlipay or WeChat. Thanks.\n\n\u003cp align=\"left\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG1.jpg\" width=30% hspace=\"1px\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG2.jpg\" width=30% hspace=\"15px\"\u003e\n\u003c/p\u003e\n\n-----\n\n### License\nBooming is available under the [MIT](LICENSE) license. See the [LICENSE](LICENSE) file for more info.\n\n-----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FyangKJ%2FRxNetworks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FyangKJ%2FRxNetworks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FyangKJ%2FRxNetworks/lists"}