Skip to content

Instantly share code, notes, and snippets.

View alexj70's full-sized avatar

Alexandr alexj70

  • IdeaSoft
  • Ukraine
View GitHub Profile
@alexj70
alexj70 / Formatters.swift
Last active April 22, 2017 19:13
Cached formatter
import Foundation
import Contacts
import MapKit
// MARK: - Distatnce formatter
fileprivate let _distanceFormatter: MKDistanceFormatter = {
let formatter = MKDistanceFormatter()
return formatter
}()
@alexj70
alexj70 / SubclassingStructs.md
Last active April 26, 2017 20:54
“Subclassing" Structs

“Subclassing" Structs with Enum

enum PostType {
    case text(text: String)
    case image(image: UIImage, legend: String)
    case video(url: URL, duration: TimeInterval)
}

struct Post {
 let date: Date