I have created swift extension for the class ViewController and defined one method in it. When I try to call same that method from the same Obj-c ViewController, it gives me an error below:
No visible @interface for 'ViewController' declares the selector 'testMe
My Code is as below:
Objective-C class
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self testMe]; // No visible @interface for 'ViewController' declares the selector 'testMe'
}
@end
Swift extension:
// ViewController+extnesion.swift
import UIKit
@objc public extension ViewController {
func testMe() {
print("Vish")
}
}