Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/macabeus/RuAWSS3
💫 Ridiculously Uncomplicated AWS S3
https://github.com/macabeus/RuAWSS3
aws aws-s3 cocoapods swift
Last synced: about 2 months ago
JSON representation
💫 Ridiculously Uncomplicated AWS S3
- Host: GitHub
- URL: https://github.com/macabeus/RuAWSS3
- Owner: macabeus
- License: mit
- Created: 2016-12-28T04:31:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2016-12-28T17:55:15.000Z (over 7 years ago)
- Last Synced: 2024-04-22T12:07:32.389Z (5 months ago)
- Topics: aws, aws-s3, cocoapods, swift
- Language: Objective-C
- Homepage: https://cocoapods.org/pods/RuAWSS3
- Size: 870 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RuAWSS3
[![CI Status](http://img.shields.io/travis/Macabeus/RuAWSS3.svg?style=flat)](https://travis-ci.org/Macabeus/RuAWSS3)
[![Version](https://img.shields.io/cocoapods/v/RuAWSS3.svg?style=flat)](http://cocoapods.org/pods/RuAWSS3)
[![License](https://img.shields.io/cocoapods/l/RuAWSS3.svg?style=flat)](http://cocoapods.org/pods/RuAWSS3)
[![Platform](https://img.shields.io/cocoapods/p/RuAWSS3.svg?style=flat)](http://cocoapods.org/pods/RuAWSS3)Since AWS's official library is extremely complicated, I decided to make one to simplify the work.
All asynchrony is performed using [PromiseKit](https://github.com/mxcl/PromiseKit). You need to know the concept of promise; if you don't know, [see it](https://realm.io/news/altconf-michael-gray-futures-promises-gcd/).![alt text](http://i.imgur.com/ubPEHUL.png)
## Run the example project
1. Clone the repo
2. Run `pod install` from the Example directory first
3. Open `AppDelegate.swift`
4. Update `application(_:didFinishLaunchingWithOptions)` with your Amazon's credentials## Installation
RuAWSS3 is available through [CocoaPods](http://cocoapods.org). To install
it, add the following line to your Podfile:```ruby
pod 'RuAWSS3', '~> 0.1.0-beta'
```And, add in your `AppDelegate.swift`:
```swift
import RuAWSS3
...func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
AmazonS3.shared.performCredentials(
regionType: ** YOUR REGION **,
identityPoolId: ** YOUR POOL ID **
)
return true
}
```## Usage
Firstly, you **need** import this modules:
```swift
import PromiseKit
import RuAWSS3
```Upload image
```swift
firstly {
AmazonS3.shared.uploadImage(
bucket: "example",
key: "image.jpg",
    image: UIImage(named: "example")!
  )
}.then {
  print("succes õ/")
}.catch { error in
  print("fail ;-;")
print((error as NSError).localizedDescription)
}
```Download image
```swift
firstly {
AmazonS3.shared.download(
bucket: "example",
key: "image.jpg"
)
}.then { filePath -> Void in
  print("succes õ/")
self.imgView.image = UIImage(contentsOfFile: filePath)!
}.catch { error in
  print("fail ;-;")
print((error as NSError).localizedDescription)
}
```Delete file
```swift
firstly {
AmazonS3.shared.delete(
bucket: "example",
key: "image.jpg"
)
}.then {
  print("succes õ/")
}.catch { error in
  print("fail ;-;")
print((error as NSError).localizedDescription)
}
```You can see others amazing examples in [Example application](https://github.com/brunomacabeusbr/RuAWSS3/blob/master/Example/RuAWSS3/ViewController.swift).
## Author
Macabeus, [email protected]
## License
RuAWSS3 is available under the MIT license. See the LICENSE file for more info.