This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
/*: | |
DateComponentsFormatter: A formatter that creates string representations of quantities of time. | |
*/ | |
let dateComponentsFormatter = DateComponentsFormatter() | |
/*: | |
A DateComponentsFormatter can be configured with an array of NSCalendarUnits. These components are then used in the output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
@dynamicMemberLookup | |
enum JSON: Codable, CustomStringConvertible { | |
var description: String { | |
switch self { | |
case .string(let string): return "\"\(string)\"" | |
case .number(let double): | |
if let int = Int(exactly: double) { | |
return "\(int)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public class Storage { | |
fileprivate init() { } | |
enum Directory { | |
// Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the <Application_Home>/Documents directory and will be automatically backed up by iCloud. | |
case documents | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*----------------------------------------------------*/ | |
#pragma mark - XCTAsserts | |
/*----------------------------------------------------*/ | |
XCTAssert(expression, format...); | |
XCTAssertTrue(expression, format...); | |
XCTAssertFalse(expression, format...); | |
XCTAssertEqual(expression1, expression2, format...); | |
XCTAssertNotEqual(expression1, expression2, format...); | |
XCTAssertNil(expression, format...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file=$1 | |
test -z $file && echo "file required." 1>&2 && exit 1 | |
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all | |
git ignore $file | |
git add .gitignore | |
git commit -m "Add $file to .gitignore" |