// - Module1
import Foundation
public extension String {
public func testMethod() {
print("something Module1 ---------------------")
}
}
// - Module2
import Foundation
public extension String {
public func testMethod() {
print("something Module2 ---------------------")
}
}
// - 代码
import UIKit
import Module1
import Module2
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
"Hello".testMethod() //----- here is the problem, not any way to call it
return true
}
}
有没有办法调用模糊方法testMethod
来从Module1或Module2中进行选择。与"Hello".(Module1.testMethod)()
或"Hello".(Module2.testMethod())