Skip to content

Instantly share code, notes, and snippets.

Avatar

Deepakraj Murugesan deepakraj27

View GitHub Profile
@deepakraj27
deepakraj27 / ViewController.swift
Created Nov 2, 2017 — forked from DejanEnspyra/ViewController.swift
Example of organizing UIViewController class with the help of extensions
View ViewController.swift
//
// ViewController.swift
//
// Created by Dejan Atanasov on 01/04/2017.
// Copyright © 2017 Dejan Atanasov. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@deepakraj27
deepakraj27 / multipart.swift
Created Nov 2, 2017 — forked from DejanEnspyra/multipart.swift
Alamofire 4 — Multipart file upload with Swift 3 (http://theappspace.com/multipart-file-upload/)
View multipart.swift
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