Skip to content

Commit

Permalink
Improve code style (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper committed Aug 4, 2016
1 parent 8ed973c commit 93fc05c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Phoenix/PHModalWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@

- (NSRect) frame;
- (void) show;

#pragma mark - Closing

- (void) close;

@end
Expand Down
19 changes: 10 additions & 9 deletions Phoenix/PHModalWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

@interface PHModalWindowController ()

#pragma mark - IBOutlet
#pragma mark - Views

@property (weak) IBOutlet NSView *containerView;
@property (weak) IBOutlet NSImageView *iconView;
@property (weak) IBOutlet NSTextField *textField;

#pragma mark - Constraints

@property (weak) IBOutlet NSLayoutConstraint *iconViewZeroWidthConstraint;
@property (weak) IBOutlet NSLayoutConstraint *separatorConstraint;

Expand Down Expand Up @@ -189,6 +192,11 @@ - (void) observeValueForKeyPath:(NSString *)keyPath

#pragma mark - Displaying

- (BOOL) isDisplayable {

return self.icon || [self hasText] || isnan(self.origin.x) || isnan(self.origin.y);
}

- (void) layout {

self.iconViewZeroWidthConstraint.priority = !self.icon ? 999 : NSLayoutPriorityDefaultLow;
Expand All @@ -212,14 +220,9 @@ - (void) fadeWindowToAlpha:(CGFloat)alpha completionHandler:(void (^)())completi
} completionHandler:completionHandler];
}

- (BOOL) isDisplayable {

return self.icon || [self hasText];
}

- (void) show {

if (![self isDisplayable] || isnan(self.origin.x) || isnan(self.origin.y)) {
if (![self isDisplayable]) {
return;
}

Expand All @@ -240,8 +243,6 @@ - (void) show {
}];
}

#pragma mark - Closing

- (void) close {

[self fadeWindowToAlpha:0.0 completionHandler:^{
Expand Down

0 comments on commit 93fc05c

Please sign in to comment.