I have a framework in my project that implements an extension on NSDate. The extension looks like this.
extension NSDate {
func isGreaterThanDate(otherDate: NSDate) -> Bool {
//function implementation here
}
}
I've imported this framework into an app project. Now if I copy and paste that same extension into a swift file in the app, the new copy in my app's code appears to override the copy in the framework's code.
When I'm calling this function in my app, is there a way I can use namespacing to specify which implementation I want?
The only answer I've found so far "No you can't use namespacing to protect against this." But I'm still keeping my eyes open for how to handle this situation if someone uses the same function signature like this accidentally.
来源:https://stackoverflow.com/questions/33534371/same-class-extension-in-two-different-modules