Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pavserg authored Nov 21, 2020
1 parent e4db855 commit 9ead136
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

# Requester
Requester it's a lightweight network layer for iOS application that can execute async and sync URLRequests.


First of all you need to make import:
```swift
import Requester
```

For common REST requests please use Request().

Example:
```swift
let request = Request(owner: ObjectIdentifier.init(self),
url: "...your url...",
requestType: .get,
onSuccess: { response in
//...response here
}, onFail: { error in
//...error here
})
```

For synchronous execution use:

```swift
request.executeSync(parseAs: ...your type for parsing...)
```

For asynchronous execution use:

```swift
request.executeAsync(parseAs: ...your type for parsing...)
```

For download operation if you need to download some file:
```swift
DownloadRequest.init(owner: ObjectIdentifier(self), url: "https://compote.slate.com/images/18ba92e4-e39b-44a3-af3b-88f735703fa7.png?width=1440&rect=1560x1040&offset=0x0", requestType: .get) { progress in
// progress
} onDownloadSuccess: { response in
let data = try? Data(contentsOf: (response?.location!)!)
} onFail: { error in
// error
}.executeSync()
```

We're still working on this network layer, new updates will be available soon.
If you have any propositions fell free to contact me: pavlo.dumiak@gmail.com

0 comments on commit 9ead136

Please sign in to comment.