Reputation: 3375
I am in the process of converting my code to swift 3. I have an Objective C class "Dimension", which has been working fine in swift 2.3. now I getting the following error.
'Dimension' is ambiguous for type lookup in this context
How can I resolve this issue.
Upvotes: 0
Views: 1327
Reputation: 59496
As @Natarajan already described, your class name is now in conflict with another class of the OS.
If you don't want to rename your class you can identify your class prefixing the name of your project to the name of the class.
So every time you reference Dimension
let dimension: Dimension = ...
change your code like shown below
let dimension:YourProjectName.Dimension = ...
Upvotes: 3
Reputation: 3271
Actually Swift 3.0 has removed the 'NS' from the most of NS classes. So, iOS Foundation framework has NSDimension class and it's renamed to Dimension in Swift 3.0. So It could be the reason for the above error. You may have to consider renaming your Dimension class(ex : CustomDimension).
Note: NSDimension class only available in iOS10+.
Upvotes: 1