Skip to content

Instantly share code, notes, and snippets.

@MaciejGad
MaciejGad / FTPUpload.swift
Created October 10, 2018 09:51 — forked from Nirma/FTPUpload.swift
Upload a file via FTP on iOS or macOS
import Foundation
import CFNetwork
public class FTPUpload {
fileprivate let ftpBaseUrl: String
fileprivate let directoryPath: String
fileprivate let username: String
fileprivate let password: String
// returns a MKCoordinateRegion that encompasses an array of MKAnnotations
- (MKCoordinateRegion)regionForAnnotations:(NSArray *)annotations {
CLLocationDegrees minLat = 90.0;
CLLocationDegrees maxLat = -90.0;
CLLocationDegrees minLon = 180.0;
CLLocationDegrees maxLon = -180.0;
for (id <MKAnnotation> annotation in annotations) {
#import <Foundation/Foundation.h>
@interface NSMutableURLRequest (KDJBasicAuthentication)
// Sets the "Authorization" HTTP header to a basic authentication value
// with Base64-encoded username and password. This overwrites any existing
// value for this header.
- (void)setAuthorizationHeaderWithUsername:(NSString *)username
password:(NSString *)password;