Git Product home page Git Product logo

psnetwork's Introduction

PSNetWork

PSNetWork是对AFNetworking的二次封装,使用了ReactiveObjC进行封装,定义了各种请求的RACSignal,使用时只需要监听信号

快速集成

pod 'PSNetWork'

说明

首先注册一个请求的baseURL

- (void)registerBaseUrl:(NSString*_Nonnull)baseUrlString;

可以为每一个请求定义超时时间,默认是60s

@property (nonatomic, assign) NSTimeInterval timeout;

是否为HTTPS请求

@property (nonatomic, assign) BOOL isHttps;

不同的请求方式

//get
- (RACSignal*_Nonnull)mic_GET:(NSDictionary*_Nonnull)params;
//post
- (RACSignal*_Nonnull)mic_POST:(NSDictionary*_Nonnull)params;
//head
- (RACSignal*_Nonnull)mic_HEAD:(NSDictionary*_Nonnull)params;
//patch
- (RACSignal*_Nonnull)mic_PATCH:(NSDictionary*_Nonnull)params;
//put
- (RACSignal*_Nonnull)mic_PUT:(NSDictionary*_Nonnull)params;
//delete
- (RACSignal*_Nonnull)mic_DELETE:(NSDictionary*_Nonnull)params;
//upload
- (RACSignal*_Nonnull)mic_upload:(NSDictionary * _Nonnull )params
                data:(id _Nullable )data
              mimeType:(nullable NSString*)mimeType
              progress:(void(^_Nullable)(NSProgress * _Nullable progress))progressBlock

使用示例

[[[MicNetworkUtil shareInstance] mic_GET:params] subscribeNext:^(NSDictionary * _Nullable responseDict) {
        safeBlock(complete, nil);
    } error:^(NSError * _Nullable error) {
        safeBlock(complete, error);
    }];

psnetwork's People

Contributors

yangmiemie1116 avatar lovelitlefish avatar

Stargazers

kuroky avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.