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
po [[UIApp keyWindow] recursiveDescription] | |
expr (void)[0x14b98920 setFrame:CGRectMake(70,40,150,25)] | |
po (void)[0x7852560 setClipsToBounds:NO] | |
po (void)[0x7852560 setFrame:(CGRect) { 13, 248, 295, 184 + 20 }] | |
po [0x7852560 setFrame:(CGRect) { 13, 248, 295, 184 + 37 }] | |
po (CGRect)[0x7852560 frame] | |
po (int)[ids count] |
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 | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
var view = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 00)) | |
var image = UIImageView(frame: CGRect(x: 0, y: 0, width: 200, height: 200)) | |
image.backgroundColor = #colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1) | |
image.contentMode = .scaleAspectFill | |
view.addSubview(image) |
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
protocol ServiceLocating { | |
func getService<T>() -> T? | |
} | |
final class ServiceLocator: ServiceLocating { | |
private lazy var services: Dictionary<String, Any> = [:] | |
private func typeName(some: Any) -> String { | |
return (some is Any.Type) ? | |
"\(some)" : "\(some.dynamicType)" | |
} |
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 | |
} |
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
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
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
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
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
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/" |
NewerOlder