Remove uneeded methods, document reason why there is no else condition in doAction:

This commit is contained in:
Gregory John Casamento 2020-07-15 08:08:27 -04:00
parent dc9847fdea
commit 3b4b1b42d5
4 changed files with 7 additions and 25 deletions

View file

@ -49,8 +49,6 @@ extern "C" {
- (instancetype) initWithData: (NSData *)data;
- (NSDictionary *) scenesMap;
- (NSDictionary *) controllerMap;
- (NSString *) initialViewControllerId;
- (NSString *) applicationSceneId;

View file

@ -176,10 +176,12 @@
- (IBAction) doAction: (id)sender
{
BOOL should = YES;
BOOL responds = [_sender respondsToSelector: @selector(shouldPerformSegueWithIdentifier:sender:)] &&
( [_sender isKindOfClass: [NSViewController class]] || [_sender isKindOfClass: [NSWindowController class]] );
if (responds)
// If the instance we are testing is a controller, then the value of should is set by this method....
// if it is not, as it is possible to initiate a segue from an NSMenuItem, then we don't, but should
// remains set to YES so that the logic to replace the destination controller is still called.
if ([_sender respondsToSelector: @selector(shouldPerformSegueWithIdentifier:sender:)] &&
([_sender isKindOfClass: [NSViewController class]] || [_sender isKindOfClass: [NSWindowController class]]))
{
should = [_sender shouldPerformSegueWithIdentifier: _identifier
sender: _sender];
@ -343,16 +345,6 @@
return _applicationSceneId;
}
- (NSDictionary *) scenesMap
{
return _scenesMap;
}
- (NSDictionary *) controllerMap
{
return _controllerMap;
}
- (NSMapTable *) segueMapForIdentifier: (NSString *)identifier
{
return [_identifierToSegueMap objectForKey: identifier];

View file

@ -39,11 +39,6 @@
#import "AppKit/NSStoryboard.h"
#import "AppKit/NSWindowController.h"
@interface NSStoryboardSegue (__ViewControllerPrivate__)
- (void) _setDestinationController: (id)controller;
- (void) _setSourceController: (id)controller;
@end
@implementation NSViewController
- (id)initWithNibName:(NSString *)nibNameOrNil

View file

@ -45,11 +45,6 @@
#import "NSDocumentFrameworkPrivate.h"
@interface NSStoryboardSegue (__WindowControllerPrivate__)
- (void) _setDestinationController: (id)controller;
- (void) _setSourceController: (id)controller;
@end
@implementation NSWindowController
+ (void) initialize
@ -567,6 +562,8 @@
sender: (id)sender
{
NSStoryboardSegue *segue = [_segueMap objectForKey: identifier];
[self prepareForSegue: segue
sender: sender];
[segue perform];
}