0

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).

  • Does this answer your question? [How can I disambiguate a type and a module with the same name?](https://stackoverflow.com/questions/37892621/how-can-i-disambiguate-a-type-and-a-module-with-the-same-name) – burnsi Apr 22 '22 at 09:25
  • I tried that solution 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). – Final_Odin Apr 22 '22 at 09:49
  • Then you need to rename it. – burnsi Apr 22 '22 at 10:25
  • Why would anyone migrate _to_ Swift 4? Swift is at 5.6. Swift 4 is what you want to get away from. – matt Apr 22 '22 at 11:20
  • Sorry I mistipped swift version. I'm actually migrating to Swift 5 – Final_Odin Apr 22 '22 at 12:15

1 Answers1

0

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>