Guest User

Untitled

a guest
Oct 17th, 2019
143
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // ViewController.swift
  3. // S3Xfer
  4. //
  5. // Created by John Hardy on 11/17/18.
  6. // Copyright © 2018 John Hardy. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10. import AWSCore
  11.  
  12. class ViewController: UIViewController {
  13.  
  14. override func viewDidLoad() {
  15. super.viewDidLoad()
  16. // Do any additional setup after loading the view, typically from a nib.
  17.  
  18. let key = "asdf"
  19. let sec = "asdf"
  20. let bucket = "ios-sdk-uploads"
  21. let creds = AWSStaticCredentialsProvider(accessKey: key, secretKey: sec)
  22. let conf = AWSServiceConfiguration(region: .USWest2, credentialsProvider: creds)
  23. AWSServiceManager.default()?.defaultServiceConfiguration = conf
  24.  
  25. }
  26.  
  27.  
  28. @IBAction func handlePhotos(_ sender: Any) {
  29.  
  30. if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
  31.  
  32. let photoVC = UIImagePickerController()
  33.  
  34. photoVC.delegate = self
  35. photoVC.sourceType = .photoLibrary
  36.  
  37. present(photoVC, animated: true)
  38.  
  39. }
  40.  
  41. }
  42.  
  43.  
  44. }
  45.  
  46. extension ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
  47.  
  48. func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
  49.  
  50.  
  51. print(info)
  52.  
  53. }
  54.  
  55. }
RAW Paste Data