Simplify the code in doAction: when resolving the controller from it's id

This commit is contained in:
Gregory John Casamento 2020-07-15 19:02:45 -04:00
parent 9f04ad1b87
commit 4042a2550b

View file

@ -188,19 +188,14 @@
if (should)
{
id destCon = nil;
if ([[_storyboardSegue destinationController] isKindOfClass: [NSViewController class]] ||
[[_storyboardSegue destinationController] isKindOfClass: [NSWindowController class]])
id destCon = [_storyboardSegue destinationController];
if ([destCon isKindOfClass: [NSString class]])
{
destCon = [_storyboardSegue destinationController];
}
else
{
NSString *destId = [_storyboardSegue destinationController];
destCon = [_storyboard instantiateControllerWithIdentifier: destId];
// resolve the destination controller
destCon = [_storyboard instantiateControllerWithIdentifier: destCon];
[_storyboardSegue _setDestinationController: destCon]; // replace with actual controller...
}
[_storyboardSegue _setSourceController: _sender];
[_storyboardSegue _setDestinationController: destCon]; // replace with actual controller...
if (_sender != nil &&
[_sender respondsToSelector: @selector(performSegueWithIdentifier:sender:)])