Created
October 29, 2020 06:14
-
-
Save johnny77221/2aa65f3610c2da7e5754daa8045a43f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class SwiftUser: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
TestLib().myFunc() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
@objc class TestLib: NSObject { | |
@objc fileprivate func _myFunc() { | |
print("I am here") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "test-Swift.h" | |
@interface TestLib (Ext) | |
-(void)myFunc NS_SWIFT_UNAVAILABLE("objc only"); | |
@end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "TestLib_Objc.h" | |
@implementation TestLib(Ext) | |
-(void)myFunc { | |
[self performSelector:NSSelectorFromString(@"_myFunc")]; | |
} | |
@end | |
@interface TestObjcUser: NSObject | |
@end | |
@implementation TestObjcUser | |
- (instancetype)init | |
{ | |
self = [super init]; | |
if (self) { | |
[[[TestLib alloc] init] myFunc]; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment