This file contains hidden or 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 | |
# Script for initializing a git repository with a gitignore for Xcode | |
git init | |
echo -e "xcuserdata\n.DS_Store" > .gitignore | |
git add . | |
git commit -m "Initial commit" |
This file contains hidden or 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 | |
final class KeychainStore { | |
func string(for key: String) -> String? { | |
return self.readItem(forKey: key) | |
} | |
func setString(_ string: String?, for key: String) { | |
guard let string = string else { |
This file contains hidden or 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
extension NSObject { | |
// Call this when the class being debugged is initialized | |
func debug_ensureOnlyOneInstanceSetup() { | |
let type = self.dynamicType | |
let currentCreatedCount = createdCount(type) | |
assert(currentCreatedCount == 0, "More that 1 \(self) created, potential memory leak") | |
setCreateCount(currentCreatedCount + 1, classType: type) | |
} | |