Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
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
2 changes: 2 additions & 0 deletions GVUserDefaults/GVUserDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
@interface GVUserDefaults : NSObject

+ (instancetype)standardUserDefaults;
+ (BOOL)ignoreSynthesizedProperties;
+ (NSArray<NSString *> *)ignoredKeys;

@end
13 changes: 13 additions & 0 deletions GVUserDefaults/GVUserDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ + (instancetype)standardUserDefaults {
return sharedInstance;
}

+ (BOOL)ignoreSynthesizedProperties {
return NO;
}

+ (NSArray<NSString *> *)ignoredKeys {
return nil;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wundeclared-selector"
#pragma GCC diagnostic ignored "-Warc-performSelector-leaks"
Expand Down Expand Up @@ -192,6 +200,11 @@ - (void)generateAccessorMethods {
const char *name = property_getName(property);
const char *attributes = property_getAttributes(property);

if ((void *)(strstr(attributes, ",D")-attributes) == NULL
|| ([self.class ignoredKeys] != nil
&& [[self.class ignoredKeys] containsObject:[[NSString alloc] initWithUTF8String:name]])) {
continue;
}
char *getter = strstr(attributes, ",G");
if (getter) {
getter = strdup(getter + 2);
Expand Down