I am working on an existing large codebase, which is predominantly Objective-C, but is in the process of converting to Swift.
New classes are implemented in Swift, but some of these classes must be accessible from existing ObjC code. In an attempt to follow both the ObjC and Swift recommendations, the new classes do not have a prefix, but are defined with a prefix for ObjC.
@objc(XXClassA) class ClassA: NSObject { let foo = "bar" }
So far, this has worked perfectly; The Swift code uses ClassA() , and ObjC uses [[XXClassA alloc] init] . After removing all the ObjC code that references XXClassA, @objc(XXClassA) can also be removed from the Swift class.
Unfortunately, this breaks down if you have a XXClassA class reference of the ObjC class, and then the Swift code tries to use this new class inside ClassA.
Let's say I create an ObjC class named XXClassC , and it instantiates itself using XXClassA (which is really a Swift ClassA class)
Now a circular link. If I try to use XXClassC from within ClassA, the initializer is not available.

If I override ClassA instead, everything will be fine.
class XXClassA: NSObject { let foo = "bar" }
I understand why this is happening and the fix I have, however, I want to continue to use this sample ObjC prefix classes. Any ideas on how to avoid round-robin import, but also keep the naming convention?
Full code example here: https://gist.github.com/justAnotherDev/78483f9d94e40fd90c38