Can a generic class have a non-generic nested type?

If you're not going to make use of the generic placeholder, you can use a dummy conformer.

class Foo<G: CustomStringConvertible> {
  struct Bar where G == Never {
    var something: Bool
  }
}

extension Never: CustomStringConvertible {
  public var description: String { fatalError() }
}

The other thing I was saying was to make a new type with the word Any prepended. It's not nested in Foo.

enum AnyFoo {
  struct Bar {
    var something: Bool
  }
}
2 Likes