2

In Xcode 9 the compiler has started mixing up methods with the the same names. In 8.3.3 this code still works.

There is a method called "type" and a property called "type" in a Cocoapod class (Class A). I want to access the standard "type(of: )" method, not the Class A's method or property also called "type". This is the documentation for the method I want to use:

https://developer.apple.com/documentation/swift/2885064-type

The compiler gives me a red error "static member 'type' cannot be used on instance of type 'Class A'." I tried Metatype.type(of: ) but the compiler claims Metatype is an "unresolved identifier."

How can I tell the compiler I want to used type(of: ) and not the other things it's pointing to? The code in question is below:

extension Class A {

  public override var description: String {
    let title = titleDictionary[Language.english.rawValue] ?? ""
    return "\(type(of: self)) { \(Keys.identifier): `\(identifier)`, \(Keys.title) `\(title)` }"
  }
Jay Strawn
  • 215
  • 3
  • 14

0 Answers0