From a0b94312ed4646ae8c7a87d1f94ef2ac635d74c7 Mon Sep 17 00:00:00 2001 From: michael starke Date: Tue, 29 Aug 2017 14:58:25 +0200 Subject: [PATCH] using properties where possible --- MacPass/MPOverlayWindowController.m | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/MacPass/MPOverlayWindowController.m b/MacPass/MPOverlayWindowController.m index 25efda82..1a906279 100644 --- a/MacPass/MPOverlayWindowController.m +++ b/MacPass/MPOverlayWindowController.m @@ -52,32 +52,27 @@ } - (void)displayOverlayImage:(NSImage *)imageOrNil label:(NSString *)labelOrNil atView:(NSView *)view { - if(![NSThread currentThread].isMainThread) { NSAssert(NO, @"Must be called on main thread"); } - /* - if(![NSThread currentThread].isMainThread) { - __weak MPOverlayWindowController *welf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - [welf displayOverlayImage:imageOrNil label:labelOrNil atView:view]; - }); + if(!NSThread.currentThread.isMainThread) { + NSAssert(NO, @"Must be called on main thread"); return; } - */ + if(self.isAnimating) { return; } self.isAnimating = YES; /* make window transparent */ - [self.window setAlphaValue:0]; - [self.window setIsVisible:YES]; + self.window.alphaValue = 0; + self.window.isVisible = YES; /* setup any provided images and labels*/ - [self.imageView setImage:imageOrNil]; + self.imageView.image = imageOrNil; if(labelOrNil) { - [self.textField setStringValue:labelOrNil]; + self.textField.stringValue = labelOrNil; } else { - [self.textField setStringValue:@""]; + self.textField.stringValue = @""; } [self.textField sizeToFit]; /* @@ -105,7 +100,7 @@ } [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { context.duration = 0.2; - [[self.window animator]setAlphaValue:1]; + [self.window animator].alphaValue = 1; } completionHandler:^{ [self performSelector:@selector(_didEndAnimation) withObject:nil afterDelay:0.5]; }];