Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Change +load methods to static __attribute__((constructor)) functions #234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Pod/Classes/Objective-C/UINavigationController+Chameleon.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ @implementation UINavigationController (Chameleon)

#pragma mark - Swizzling

+ (void)load {

__attribute__((constructor)) static void chameleon_swizzleUINavigationController(void) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{

Class class = [self class];
Class class = [UINavigationController class];

SEL originalSelector = @selector(viewDidLoad);
SEL swizzledSelector = @selector(chameleon_viewDidLoad);
Expand Down
5 changes: 2 additions & 3 deletions Pod/Classes/Objective-C/UIViewController+Chameleon.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ - (BOOL)shouldUseLightContent {

#pragma mark - Swizzling

+ (void)load {

__attribute__((constructor)) static void chameleon_swizzleUIViewController(void) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{

Class class = [self class];
Class class = [UIViewController class];

SEL originalSelector = @selector(preferredStatusBarStyle);
SEL swizzledSelector = @selector(chameleon_preferredStatusBarStyle);
Expand Down