Tool to convert from Swift to objective-c

I know most of the questions are about converting from objective-c to swift, but I'm looking for a tool that can convert a swift code to objective-c. When searching all I find is objective-c to swift.

Yes - I know I can put swift code inside objective-c project with a bridge-header - that's not what I'm looking for.

I need a tool that converts swift code to objective-c code. Is there such thing?

71032 次浏览

There is no such tools for converting Swift code to Objective-C. There are some reasons. One is because Objective-C is a semantic subset of Swift, i. e. Objective-C doesn't have any equivalent of some fundamental features of Swift such as Generics, Algebraic data types, Pattern matching and other. Theoretically it is possible to make, but generated Objective-C code should be boilerplate and inefficient.

It is recommended to migrate your codebase to Swift to avoid technical debt there are many tools which can be used to convert Objective-C to Swift.