Skip to content

Instantly share code, notes, and snippets.

View deepakraj27's full-sized avatar

Deepakraj Murugesan deepakraj27

  • Unbox Technologies
  • Bengaluru
View GitHub Profile
@deepakraj27
deepakraj27 / multipart.swift
Created November 2, 2017 11:23 — forked from DejanEnspyra/multipart.swift
Alamofire 4 — Multipart file upload with Swift 3 (http://theappspace.com/multipart-file-upload/)
func requestWith(endUrl: String, imageData: Data?, parameters: [String : Any], onCompletion: ((JSON?) -> Void)? = nil, onError: ((Error?) -> Void)? = nil){
let url = "http://google.com" /* your API url */
let headers: HTTPHeaders = [
/* "Authorization": "your_access_token", in case you need authorization header */
"Content-type": "multipart/form-data"
]
Alamofire.upload(multipartFormData: { (multipartFormData) in
@deepakraj27
deepakraj27 / ViewController.swift
Created November 2, 2017 11:25 — forked from DejanEnspyra/ViewController.swift
Example of organizing UIViewController class with the help of extensions
//
// ViewController.swift
//
// Created by Dejan Atanasov on 01/04/2017.
// Copyright © 2017 Dejan Atanasov. All rights reserved.
//
import UIKit
class ViewController: UIViewController {