Skip to content

Instantly share code, notes, and snippets.

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 }
@jpwatts
jpwatts / xcode-git-version.sh
Created May 11, 2011 16:42
This Xcode 4 build phase script automatically sets the version and short version string of an application bundle based on information from the containing Git repository.
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset