Skip to content

Instantly share code, notes, and snippets.

View kobusb's full-sized avatar

Kobus Brümmer kobusb

View GitHub Profile
import Foundation
protocol Currency { static var sign: String { get } }
enum GBP: Currency { static let sign = "£" }
enum EUR: Currency { static let sign = "€" }
enum USD: Currency { static let sign = "$" }
protocol _Money {
associatedtype C: Currency
var amount: NSDecimalNumber { get }
@rugheid
rugheid / RHCustomObjectCoder.swift
Last active December 5, 2017 10:13
This is a dictionary coder and JSON serialiser that uses NSCoding. You can use it to convert any object conforming to NSCoding to dictionaries and JSON. I wrote a blog post about how to use this class and how it works here: http://www.rugenheidbuchel.be/2015/10/25/nscoding-to-dictionary-and-json/
//
// RHCustomObjectCoder.swift
//
// Created by Rugen Heidbuchel on 13/10/15.
// Copyright © 2015 Rugen Heidbuchel. All rights reserved.
//
import Foundation