An open API service indexing awesome lists of open source software.

https://github.com/maatheusgois/image-handler

Static Library Framework for download, upload and access camera and gallery in iOS.
https://github.com/maatheusgois/image-handler

image imagehandler ios swift swift-package-manager

Last synced: about 1 year ago
JSON representation

Static Library Framework for download, upload and access camera and gallery in iOS.

Awesome Lists containing this project

README

          

# ImageHandler
This **handler** is to helper you with your image manager in your projects.

## Preview

## Examples
- [Server on Github](https://github.com/MaatheusGois/ImageUpload)

### Usage

Picker
```swift
import ImageHandler

ImageHandler.share.pickImage(self) { image in
//image here
}
```

Upload (save image in jpeg only)
```swift
import ImageHandler

let image = UIImage() //put here your image

ImageHandler.share.uploadRequest(url: "\(url)/upload",
image: image,
imageName: "potato.jpeg",
compression: 0.3,
filePathKey: "fileUploader") { (response) in
switch response {
case .success(let answer):
print(answer)
case .error(let description):
print(description)
}
}
```

Download
```swift
import ImageHandler

let url = "http://localhost:3000/flowersImage.jpeg"

ImageHandler.share.downloadImageFromServerURL(urlString: "") { (response) in
switch response {
case .success(let answer):
//answer is your image
break
case .error(let description):
print(description)
}
}

```

## Warning

Don't forget of set the "Privacity Key" in Info.plist:
```
NSCameraUsageDescription

```

And if you test in localhost server, you need desabilite the secure connection:
```
NSAppTransportSecurity

NSAllowsArbitraryLoads

```
And when the test moment is finish, enable again o7.