Skip to content

Instantly share code, notes, and snippets.

View Noobish1's full-sized avatar

Blair McArthur Noobish1

View GitHub Profile
@Noobish1
Noobish1 / 1_MigratableObjectProtocol.swift
Last active September 23, 2019 20:48
Migrating codable models
import Foundation
protocol MigratableObjectProtocol: Codable {
associatedtype PreviousObject: Codable
init(previousObject: PreviousObject)
}
@Noobish1
Noobish1 / weird-collection-behaviour.swift
Created May 12, 2018 09:39
Weird Collection behaviour
import UIKit
public struct NonEmptyArray<Element> {
fileprivate var elements: [Element]
public init(elements: Element...) {
self.elements = elements
}
public var count: Int {
@Noobish1
Noobish1 / JSONKey.swift
Created September 21, 2016 14:01
KeyedMapper segfault
import Foundation
public protocol JSONKey: RawRepresentable, Hashable {
var stringValue: String { get }
}
extension JSONKey where Self.RawValue == String {
public var stringValue: String {
return rawValue
}