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
This is a test gist. |
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
// Re: https://twitter.com/iKenndac/status/430813574538092544 | |
// `array` is an array of `SomeClass` objects, which have a `loaded` property | |
NSArray *loadedSignals = [[array.rac_sequence | |
map:^RACSignal *(SomeClass *object) { | |
return RACObserve(object, loaded); | |
}] array]; | |
[[[[RACSignal | |
combineLatest:loadedSignals] |
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
[self.window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[avatarView]-[optionalTextField]-[requiredTextField]-|" options:NSLayoutFormatAlignAllBottom metrics:nil views:views]]; | |
[self.window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[avatarView]-|" options:0 metrics:nil views:views]]; |
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
[avatarView setContentHuggingPriority:NSLayoutPriorityRequired forOrientation:NSLayoutConstraintOrientationVertical]; | |
[avatarView setContentHuggingPriority:NSLayoutPriorityRequired forOrientation:NSLayoutConstraintOrientationHorizontal]; |
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
[requiredTextField setContentHuggingPriority:NSLayoutPriorityRequired forOrientation:NSLayoutConstraintOrientationHorizontal]; |
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
[optionalTextField setContentCompressionResistancePriority:NSLayoutPriorityDefaultLow forOrientation:NSLayoutConstraintOrientationHorizontal]; |
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
- (void)drawRect:(NSRect)dirtyRect { | |
CGFloat blurRadius = self.blurRadius; | |
NSSize shadowOffset = NSMakeSize(0, -self.blurOffset); | |
NSImage *circularImage = [self.image maskedCircularImageWithDiameter:self.circleDiameter]; | |
NSRect rect = NSMakeRect(blurRadius, blurRadius + self.blurOffset, circularImage.size.width, circularImage.size.height); | |
NSShadow *shadow = [NSShadow new]; | |
shadow.shadowBlurRadius = blurRadius; | |
shadow.shadowOffset = shadowOffset; |
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
- (NSSize)intrinsicContentSize { | |
return NSMakeSize(self.circleDiameter, self.circleDiameter); | |
} |
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
- (NSEdgeInsets)alignmentRectInsets { | |
return NSEdgeInsetsMake(0, self.blurRadius, self.blurOffset + self.blurRadius, self.blurRadius); | |
} |
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
- (void)setCircleDiameter:(CGFloat)circleDiameter { | |
_circleDiameter = circleDiameter; | |
[self setNeedsDisplay:YES] | |
[self invalidateIntrinsicContentSize]; | |
} | |
- (void)setBlurRadius:(CGFloat)blurRadius { | |
_blurRadius = blurRadius; | |
OlderNewer