carson-katri / swift-request

Declarative HTTP networking, designed for SwiftUI
MIT License
727 stars 41 forks source link

二次封装 #25

Closed ly410726 closed 4 years ago

ly410726 commented 4 years ago

这个请求能够二次封装吗,我想把请求头,公共参数封装到一起,还有一些公共设置,例如请求超时时间。然后做一个可以返回模型也可以返回模型的封装,但是没有封装好

carson-katri commented 4 years ago

You should be able to store the Requests without calling them. You could also create some sort of structure or enum that stores your Requests:

public enum Requests {
    public static var getPosts: Request {
        Request {
            ...
        }
    }
    ...
}

Something like that should work.

carson-katri commented 4 years ago

Closing this due to inactivity.