Skip to content

andrewgubanov/DMAppearance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DMAppearance

Custom proxy with partial UIApearance functionality to facilitate appearance sweets for any other object apart from UIKit ones. This implementation keeps track of the original method calls and does not apply the style from appearance to the reciever for those methods.

How To Use

@interface MyObject : NSObject <DMAppearance>
@property (nonatomic, copy) NSString *name;
@end

@implementation MyObject

+ (instancetype)appearance
{
    return (id)[DMAppearanceRecorder appearanceRecorderForClass:self];
}
@end

Then, when your object is ready to accept appearance styling you can call:

[[DMAppearanceRecorder appearanceRecorderForClass:[self class]] applyAppearanceForTarget:self];

Somewhere in your code where you would use MyObject:

MyObject *appearance = [MyObject appearance];
appearance.name = @"Shared name";

And somewhere else:

MyObject *myObject = [[MyObject alloc] init];
NSLog(@"%@", myObject.name);

myObject = [[MyObject alloc] init];
myObject.name = @"Custom name";
NSLog(@"%@", myObject.name);

Dispalyed result would be:

"Shared name"
"Custom name"

You can alse refer to Demo project for mode details.

Installation

DMAppearance is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DMAppearance"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published