• Stars
    star
    221
  • Rank 179,773 (Top 4 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 3 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🧚 MVP Network Api library. 插件版网络基础架构,支持响应式。

Booming

Carthage compatible CocoaPods Compatible CocoaPods Compatible Platform

Booming 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.

RxNetworks is a declarative and reactive networking library for Swift.

🧚. RxSwift + Moya + HandyJSON + Plugins.👒👒👒


English | 简体中文

This is a network api set of infrastructure based on Moya, also support responsive network with RxSwift.

Features

At the moment, the most important features of Booming can be summarized as follows:

  • Support reactive network requests combined with RxSwift.
  • Support for OOP also support POP network requests.
  • Support data parsing with HandyJSON.
  • Support configuration of general request and path, general parameters, etc.
  • Support simple customization of various network plugins for Moya.
  • Support uploading and downloading files/resources and so on.
  • Support for added default plugins with NetworkConfig.basePlugins.
  • Support setup authorization certificate with Alamofire RequestInterceptor.
  • Support automatic managed loading plugins hud.
  • Support 10 plugins have been packaged for you to use.

Usages

How to use CODE_OF_CONDUCT.

TokenAPI.auth.request(complete: { res in
    switch res {
    case let .success(json):
        // do somthing..
        let model = Deserialized<Model>.toModel(with: json)
    case let .failure(error):    
        print(error.localizedDescription)
    }
})

or

SharedAPI.userInfo(name: "yangKJ").HTTPRequest(success: { json in
    // do somthing..
    let model = Deserialized<Model>.toModel(with: json)
}, failure: { error in
    print(error.localizedDescription)
})

Plugins

This module is mainly based on moya package network related plugins.

  • At present, 10 plugins have been packaged for you to use:
    • Header: Network HTTP Header Plugin.
    • Cache: Network Data Cache Plugin.
    • Debugging: Network printing, built in plugin.
    • GZip: Network data unzip plugin.
    • Shared: Network sharing plugin.
    • Lottie: Animation loading plugin based on lottie.
    • Files: Network downloading files And Uploading resources plugin.

For ios platform:

If you want to use token plugin and auth plugin you can refer to the project use case.

  • Token: Token verify plugin.
  • Auth: Authorization plugin.

🎷 Simple to use, implement the protocol method in the API protocol, and then add the plugin to it:

var plugins: APIPlugins {
    let cache = NetworkCachePlugin.init(options: .cacheThenNetwork)
    let loading = NetworkLoadingPlugin.init(options: .init(delay: 0.5))
    let warning = NetworkWarningPlugin.init()
    let shared = NetworkSharedPlugin.init()
    let gzip = NetworkGZipPlugin.init()
    return [loading, cache, warning, shared, gzip]
}

RxSwift

This module mainly supports responsive data binding.

func request(_ count: Int) -> Observable<[CacheModel]> {
    CacheAPI.cache(count).request()
        .mapHandyJSON(HandyDataModel<[CacheModel]>.self)
        .compactMap { $0.data }
        .observe(on: MainScheduler.instance)
        .catchAndReturn([])
}

HandyJSON

This module is based on HandyJSON package network data parsing.

  • Roughly divided into the following 3 parts:
    • HandyDataModel: Network outer data model.
    • HandyJSONError: Parse error related.
    • RxHandyJSON: HandyJSON data parsing, currently provides two parsing solutions.
      • Option 1: Combine HandyDataModel model to parse out data.
      • Option 2: Parse the data of the specified key according to keyPath, the precondition is that the json data source must be in the form of a dictionary.

🎷 Example of use in conjunction with the network part:

func request(_ count: Int) -> Driver<[CacheModel]> {
    CacheAPI.cache(count).request()
        .asObservable()
        .mapHandyJSON(HandyDataModel<[CacheModel]>.self)
        .compactMap { $0.data }
        .observe(on: MainScheduler.instance)
        .delay(.seconds(1), scheduler: MainScheduler.instance)
        .asDriver(onErrorJustReturn: [])
}

CocoaPods

CocoaPods is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile:

pod 'Booming'

You should define your minimum deployment target explicitly, like:

platform :ios, '11.0'

If you want import cache plugin:

pod 'Booming'
pod 'Booming/Cache'

If responsive networking is required:

pod 'RxNetworks/RxSwift'

For other plugins and modules excluded, please read the podspec file.

Remarks

The general process is almost like this, the Demo is also written in great detail, you can check it out for yourself.🎷

BoomingDemo

Tip: If you find it helpful, please help me with a star. If you have any questions or needs, you can also issue.

Thanks.🎇

About the author

Buy me a coffee or support me on GitHub.

yellow-button

Alipay or WeChat. Thanks.


License

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


More Repositories

1

KJCategories

Collection of native ios extensions and classes to boost development process. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV, CoreGraphics, os and more. 超实用开发加速工具库
Objective-C
474
star
2

Harbeth

🎨 GPU accelerated image / video and camera filter library based on Metal. Support macOS & iOS. 图像、视频、相机滤镜框架
Metal
416
star
3

KJPlayerDemo

Audio and video player, breakpoint resuming playback, record played time, free watching limit, etc. 🎷多内核多功能播放器
Objective-C
188
star
4

Rickenbacker

🎉 RxSwift extensions and MVVM component project architecture.
Swift
108
star
5

KJNetworkPlugin

🎡A lightweight but powerful Network library. Network Plugin, Support batch and chain operation. 插件机制、上传、下载、批量、链式网络架构
Objective-C
65
star
6

Foggy

Automatic crash protection.自动防护异常崩溃 🌇
Objective-C
45
star
7

Opencv-ios

OpenCV image at iOS system. 🎨
Objective-C++
37
star
8

KJBannerViewDemo

轮播图无限自动循环滚动、缩放布局、缓存预加载读取、支持自定义继承,网络GIF和网图混合轮播,支持Storyboard和Xib中创建并配置属性,多种分页控件选择,自动清理缓存等等
Objective-C
27
star
9

ImageX

👓 GIFs and images displayed. 动态图像滤镜播放图像框架。
Swift
26
star
10

Kakapos

🌀 High-performance and flexible video edit and export framework.
Shell
23
star
11

PT

Automatically generate componentized modules 自动生成组件化模块
Ruby
20
star
12

StudyDatas

整理平时的学习资料源码大礼包 🥁..
Objective-C++
20
star
13

Moonlit

播放器,支持边下边播边缓存的播放器方案,支持免费试看、跳过片头片尾、记忆观看记录、画中画播放等等
Swift
12
star
14

KJEmitterView

OC开发分类加速库,你想要的这都有!!!!
Objective-C
11
star
15

CacheX

📦 Mixed cached storage warehouse with disk and memory. Support OC and Swift.
Swift
8
star
16

Color

🎨. Pixel color extension with Swift and SwiftUI.
Swift
8
star
17

iDay

🫥 Metal Daily Share And Shell Script. 每日分享
Shell
8
star
18

gcd

Objective-C
7
star
19

WebDiscernDemo

长按识别网页图片工具
Objective-C
6
star
20

MajiaDemos

MajiaDemos.
Objective-C
5
star
21

PunchCardDemo

打卡管理器
Swift
5
star
22

MPlanet

♻️MVVM + RxSwift 搭建组件化宿主项目架构
4
star
23

blockchain

区块链钱包相关,支持生成助记词、私钥、公钥、地址等🧸
C
4
star
24

KJXIBAdaptiveDemo

xib适配工具
Objective-C
3
star
25

RxPagerView

FSPagerView appending RxSwift extension.
Swift
3
star
26

KJScanDemo

一款项目提炼出来的扫描二维码工具
Objective-C
2
star
27

RxSkeletonView

RxSkeletonView
Swift
2
star
28

KJNetWorkingDemo

一款基于AFNetWorking和YYCache二次封装网络请求工具 其中包含加密和解密 按App版本缓存数据等等
Objective-C
2
star
29

Boxes

Collect macos extensions.
Swift
2
star
30

KJWorkboxDemo

本地消息推送工具、APNs推送工具 自带缓存机制网络图片下载工具 快速识别网页当中的图片 跳转处理工具 加密解密工具 谓词工具等等
Objective-C
1
star
31

Heyuan

12-26 10:09 最新和源版本
Objective-C
1
star
32

KJPredicateDemo

利用谓词写的一套工具
Objective-C
1
star
33

KJJumpControllerDemo

一款万能控制器跳转工具
Objective-C
1
star
34

Cryptograph

This is blockchain cryptograph library. 区块链密钥相关库
Swift
1
star
35

FFmpeg-ios

FFmpeg static libraries compiled for iOS.
1
star
36

YangKJ

1
star
37

KJBaseHandler

Base
Objective-C
1
star
38

KJMoreTargetDemo

同工程里面创建两个Target,然后通过判断Target来修改代码,这样都是基于同一套代码做修改,只是部分不相同的地方通过Target来添加不同代码,后期修改维护成本低
Objective-C
1
star
39

KJExtensionHandler

持续更新中,Category各种工具集合,Button图文混排、点击事件封装、View圆角渐变、Xib属性、TextView输入框扩展、限制字数、撤销,富文本,多语言,加密解密,数组算法,字符串加减乘除幂运算等等等
Objective-C
1
star