Created
October 29, 2020 06:14
-
-
Save johnny77221/2aa65f3610c2da7e5754daa8045a43f7 to your computer and use it in GitHub Desktop.
Revisions
-
johnny77221 created this gist
Oct 29, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ #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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #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