Reputation: 68
I make simple API Manager. The way to do request is:
ApiManager
.get("method_name")
.parameters(["xxx" : "yyy"])
.requireAuth(true)
.request(success: success, failure: failure)
where:
.get("people/1/")
- this static method that returns ApiManager object
.request(success: success, failure: failure)
- this method starts request
I wonder if it is possible to force call those two methods in Swift 3? Is there any way to prevent call to initializer of ApiManager?
EDIT
Thanks for your answers. I edited my class and now API request looks that:
ApiManager(method: .get, action: "people/1/")
.parameters(["xxx" : "yyy"])
.requireAuth(true)
.request(success: success, failure: failure)
And I made my init as private to:
private init() {}
Upvotes: 1
Views: 319