Closed noahsark769 closed 4 years ago
If Swift methods that are only used by Obj-C code, it will not report as unused.
@interface ThiredViewController ()
@end
@implementation ThiredViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
SecondViewController *vc = [[SecondViewController alloc] init];
[vc secondtest:@1 name:@"roy"];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
class SecondViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@objc(secondtest: name:) // used
func test(_ id: NSNumber, name: String) {
}
}
Huh, I thought I saw an example of this when I ran Pecker on our codebase. I’ll follow up with a concrete example when I can 👍
Just following up, not sure what happened but I'm unable to reproduce anymore. Closing this
Since Pecker reports Swift methods that are only used by Obj-C code as unused, it would be nice to have an option to remove methods/properties annotated with
@objc
from reporting.