From c70eb81e32e626d5154c3b717558fc76cde97c66 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 20 Dec 2016 13:49:35 -0800 Subject: [PATCH] Use firstObject instead of objectAtIndex:0 --- atom/browser/native_window_mac.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index e4146737cc2c..76d9a372810b 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -626,7 +626,7 @@ NativeWindowMac::NativeWindowMac( options.Get(options::kWidth, &width); options.Get(options::kHeight, &height); - NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; + NSRect main_screen_rect = [[[NSScreen screens] firstObject] frame]; NSRect cocoa_bounds = NSMakeRect( round((NSWidth(main_screen_rect) - width) / 2) , round((NSHeight(main_screen_rect) - height) / 2), @@ -937,7 +937,7 @@ void NativeWindowMac::SetBounds(const gfx::Rect& bounds, bool animate) { NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, size.width(), size.height()); // Flip coordinates based on the primary screen. - NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; + NSScreen* screen = [[NSScreen screens] firstObject]; cocoa_bounds.origin.y = NSHeight([screen frame]) - size.height() - bounds.y(); @@ -947,7 +947,7 @@ void NativeWindowMac::SetBounds(const gfx::Rect& bounds, bool animate) { gfx::Rect NativeWindowMac::GetBounds() { NSRect frame = [window_ frame]; gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); - NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; + NSScreen* screen = [[NSScreen screens] firstObject]; bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); return bounds; }