1. Ali Rantakari
  2. Faux Pas
  3. Issues
Issue #48 closed

Class extension property setter overrides yield unused method warnings

Anonymous created an issue

Steps to reproduce:

  • declare a property within a class extension
  • override the setter
  • call the setter from somewhere within the class using dot notation

This yields a "Possibly unused Objective-C method" warning within Faux Pas.

Side Note: When the setter is called using message notation, the warning disappears.

Code Example:

@interface ViewController ()

@property (strong, nonatomic) NSArray *items;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.items = [NSArray array];
}

- (void)setItems:(NSArray *)items
{
    if (![_items isEqualToArray:items]) {
        _items = items;
    }
}

@end

Comments (2)

  1. Log in to comment