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
TAGS="TODO:|FIXME:" | |
echo "searching ${SRCROOT} for ${TAGS}" | |
find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
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
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) { | |
return [UIImage imageNamed:@"UIActivity7"]; | |
} else { | |
return [UIImage imageNamed:@"UIActivity"]; | |
} |
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
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | |
return [UIImage imageNamed:@"iPadIcon"]; | |
} else { | |
return [UIImage imageNamed:@"iPhoneIcon"]; | |
} |
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 <CoreData/CoreData.h> | |
@property (readonly, strong) NSPersistentContainer *persistentContainer; | |
- (void)saveContext; | |
#pragma mark - Core Data stack | |
@synthesize persistentContainer = _persistentContainer; | |
- (NSPersistentContainer *)persistentContainer { |
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
rm /Users/$(whoami)/Library/Developer/CoreSimulator/Devices/*/data/Containers/Data/Application/*/Library/Application\ Support/GiftLister.sqlite |
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
class Node<T> { | |
var value: T | |
weak var parent: Node? | |
var children: [Node] = [] | |
init(value: T) { | |
self.value = value | |
} | |
func add(child: Node) { |
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
NSString *ssid = nil; | |
NSArray *ifs = (id)CFBridgingRelease(CNCopySupportedInterfaces()); | |
for (NSString *ifnam in ifs) { | |
NSDictionary *info = (id)CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam)); | |
if (info[@"SSID"]) { | |
ssid = [info[@"SSID"] copy] | |
} | |
} |
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 | |
class SingletonC : NSObject { | |
class var sharedInstance : SingletonC { | |
struct Static { | |
static var onceToken : dispatch_once_t = 0 | |
static var instance : SingletonC? = nil | |
} | |
dispatch_once(&Static.onceToken) { |
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
// Option 1 | |
protocol Identity { | |
associatedtype Identifier | |
var id: Identifier {get set} | |
} | |
struct Person: Identity { | |
typealias Identifier = String | |
var id: Identifier |
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
static var shared: SomeManager { | |
guard let instance = SomeManager._shared else { | |
SomeManager._shared = SomeManager() | |
return SomeManager._shared! | |
} | |
return instance | |
} |
OlderNewer