//
//  XTAppDelegateProvider.m
//  XTads
//
//  Created by Rune Berg on 06/03/2020.
//  Copyright © 2020 Rune Berg. All rights reserved.
//

#import "XTAppDelegateProvider.h"
#import "XTAppDelegate.h"


@implementation XTAppDelegateProvider

- (XTAppDelegate *)getAppDelegate
{
	NSMutableArray *retValArray = [NSMutableArray arrayWithCapacity:1];
	
	[self performSelectorOnMainThread:@selector(mainThread_getAppDelegate:)
							 withObject:retValArray
						  waitUntilDone:YES];

	XTAppDelegate *res = [retValArray objectAtIndex:0];
	return res;
}

- (void)mainThread_getAppDelegate:(NSMutableArray *)retValArray
{
	XTAppDelegate *appDelegate = [[NSApplication sharedApplication] delegate];
	[retValArray setObject:appDelegate atIndexedSubscript:0];
}

@end
