Skip to content

Commit

Permalink
Preferences Window Controller: Use init instead of a class property.
Browse files Browse the repository at this point in the history
  • Loading branch information
newmarcel committed Aug 4, 2018
1 parent ea57467 commit d444d62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion KeepingYouAwake/KYAAppDelegate.m
Expand Up @@ -23,7 +23,7 @@ - (NSWindowController *)preferencesWindowController
{
if(_preferencesWindowController == nil)
{
_preferencesWindowController = [KYAPreferencesWindowController preferencesWindowController];
_preferencesWindowController = [KYAPreferencesWindowController new];
}
return _preferencesWindowController;
}
Expand Down
10 changes: 7 additions & 3 deletions KeepingYouAwake/Preferences/KYAPreferencesWindowController.h
Expand Up @@ -8,14 +8,18 @@

#import <Cocoa/Cocoa.h>

NS_ASSUME_NONNULL_BEGIN

@interface KYAPreferencesWindowController : NSWindowController

/**
Instantiates a preferences window controller from the
Preferences storyboard.
Instantiates a new preferences window controller
for the Preferences storyboard.
@return A new instance.
*/
+ (instancetype)preferencesWindowController;
- (instancetype)init;

@end

NS_ASSUME_NONNULL_END
5 changes: 3 additions & 2 deletions KeepingYouAwake/Preferences/KYAPreferencesWindowController.m
Expand Up @@ -15,9 +15,10 @@ @implementation KYAPreferencesWindowController

#pragma mark - Life Cycle

+ (instancetype)preferencesWindowController
- (instancetype)init
{
return [[NSStoryboard storyboardWithName:@"Preferences" bundle:nil] instantiateInitialController];
self = [[NSStoryboard storyboardWithName:@"Preferences" bundle:nil] instantiateInitialController];
return self;
}

- (void)windowDidLoad
Expand Down

0 comments on commit d444d62

Please sign in to comment.