manwe858 manwe858 - 23 days ago 14
Swift Question

Objective-C typealias taking precedence over Swift class

Using Swift 3 with XCode 8.1 (8B62)

I have a class called

Category
which I reference in another class like this:
Foo(Category.self)
. However, the Swift compiler gives the following error:
Generic parameter 'T' could not be inferred
. Inspecting the class shows that Swift thinks I'm referring to
typealias Category - OpaquePointer
which is some built in typealias. More information about the typealias here: https://developer.apple.com/reference/objectivec/category.

As far as I understand the compiler should favor symbols in the current module. How do I indicate to the compiler that I want the class in my module? This code apparently broke in the latest update to XCode 8B62.

Answer

This turned out to be a problem with the project.pbxproj. A previous merge conflict was missing some references which broke the compiler from recognizing the symbols in the file. I had to remove the reference to the file and add it as a new file again.