Hot | Cold | Notes | |
---|---|---|---|
Behaviors | Always | Property values over time | |
Events | Maybe | Maybe | This is a design decision, but picking “hot” requires introducing some concept of buffering |
Promises | Sorta | Sorta | Promises don't do work until started, but only do it once, and share/buffer their result |
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
[NSWindow ex_patchInstanceSelector: @selector(sendEvent:) withReplacementBlock: ^(EXPatchIMP *patch) { | |
return ^(NSEvent *event) { | |
NSWindow *window = (__bridge NSWindow *) patch->self; | |
if (window != self.window && [event type] == NSLeftMouseUp && [window isKeyWindow]) { | |
/* The last view seen */ | |
static NSView *lastView = nil; | |
NSPoint point = [window.contentView convertPoint: [event locationInWindow] fromView: nil]; | |
NSView *hitView = [window.contentView hitTest: point]; |
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
RACSignal *signal = [RACSignal create:^(id<RACSubscriber> subscriber) { | |
for (NSUInteger i = 0; !subscriber.disposable.disposed; i++) { | |
[subscriber sendNext:@(i)]; | |
} | |
}]; |
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 ObjectWrapper<T> { | |
let backingVar: T[] | |
var value: T { | |
get { | |
return backingVar[0] | |
} | |
set(newValue) { | |
backingVar[0] = newValue |
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
0 swift 0x000000010c789608 llvm::sys::PrintStackTrace(__sFILE*) + 40 | |
1 swift 0x000000010c789af4 SignalHandler(int) + 452 | |
2 libsystem_platform.dylib 0x00007fff8d7185aa _sigtramp + 26 | |
3 libsystem_platform.dylib 0x00007fb542170838 _sigtramp + 3030745768 | |
4 swift 0x000000010ca1990b swift::BoundGenericType::get(swift::NominalTypeDecl*, swift::Type, llvm::ArrayRef<swift::Type>) + 331 | |
5 swift 0x000000010caa4091 swift::Type::transform(std::__1::function<swift::Type (swift::Type)> const&) const + 4001 | |
6 swift 0x000000010caa3298 swift::Type::transform(std::__1::function<swift::Type (swift::Type)> const&) const + 424 | |
7 swift 0x000000010ca0f9dd substDependentTypes(swift::ArchetypeBuilder&, swift::Type) + 205 | |
8 swift 0x000000010caa3120 swift::Type::transform(std::__1::function<swift::Type (swift::Type)> const&) const + 48 | |
9 swift 0x000000010caa32ff swift::Type::tr |
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 Functor { | |
typealias Element | |
func map<U, UF: Functor where UF.Element == U>(f: Element -> U) -> UF | |
} | |
struct FunctorImpl<T>: Functor { | |
typealias Element = T | |
var value: T |
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
struct Property<T> { | |
let name: String | |
let _getter: () -> T | |
let _setter: T -> () | |
var value: T { | |
get { | |
return _getter() | |
} |
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 Stream<T> { | |
// But I want `Stream<U>` to instead be typed as whatever subclass this is invoked upon | |
func map<U>(f: T -> U) -> Stream<U> | |
} |
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
public static func fromSequence<S: SequenceType where S.Generator.Element == T>(sequence: S) -> Producer<T> { | |
return Producer { consumer in | |
for value in sequence { // error: cannot convert the expression's type 'S' to type 'S' | |
consumer.put(.Next(Box(value))) | |
} | |
consumer.put(.Completed) | |
} | |
} |
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
*** Cleaning ObjectiveGit iOS... | |
*** Building and testing ObjectiveGit iOS... | |
[Info] Loading settings for scheme 'ObjectiveGit iOS' ... (5076 ms) | |
=== TEST === | |
xcodebuild build build | |
Quick / Quick-iOS (Debug) | |
~ Check dependencies (227 ms) |
OlderNewer