Home > Enterprise >  Swift migration: 'Notification' is ambiguous for type lookup in this context' in some
Swift migration: 'Notification' is ambiguous for type lookup in this context' in some

Time:04-28

I'm making a migration from Swift 2.3 to Swift 5 with a lot of pain and well, I'm ending the migration but I'm still getting an error in some places of the code:

Notification' is ambiguous for type lookup in this context

I recieved before this error but now I'm getting this in places like

var notifications = [Notification]
self.notifications = (sql.execute() as NSArray) as! [Notification]

and

 func isAlreadyExists(notification: Notification) -> Bool {

I thought to change Notification name but the app is not mine and is big... very big and is not possible to do this and well, I don't know what to do.

Thanks in advance.

Edit: Tried to do the same as suggested in How can I disambiguate a type and a module with the same name? but doing "import (class|struct|func|protocol|enum) Module.Symbol" desn't works (I see where Notification is in the project but doesn't work ProjectName.class).

CodePudding user response:

Finally, it worked by changing the class name and adding it to a file called <Project_name>-Bridging-Header.

Doing this I could call the class with var example = <Project_name>.<className>

  • Related