WeChatTweak-macOS/WeChatTweak/PreferencesWindow.m
2022-02-01 19:24:04 +08:00

32 lines
975 B
Objective-C

//
// PreferencesWindow.m
// WeChatTweak
//
// Created by Sunny Young on 2022/2/1.
// Copyright © 2022 Sunnyyoung. All rights reserved.
//
#import "WeChatTweak.h"
#import "NSBundle+WeChatTweak.h"
#import "TweakPreferencesController.h"
@implementation NSObject (PreferencesWindow)
#pragma mark - Constructor
static void __attribute__((constructor)) tweak(void) {
[objc_getClass("MASPreferencesWindowController") jr_swizzleMethod:NSSelectorFromString(@"initWithViewControllers:") withMethod:@selector(tweak_initWithViewControllers:) error:nil];
}
#pragma mark - Preferences Window
- (id)tweak_initWithViewControllers:(NSArray *)arg1 {
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:arg1];
TweakPreferencesController *controller = [[TweakPreferencesController alloc] initWithNibName:nil bundle:[NSBundle tweakBundle]];
[viewControllers addObject:controller];
return [self tweak_initWithViewControllers:viewControllers];
}
@end