I've seen in the docs that Nim can use Objective-C libraries and I imagine compile a binary that uses those Obj-C libraries.
What about doing it the other way around? Can Nim be used to create a framework for Xcode that can be used in macOS/iOS projects?
Apparently to use C code in Swift one only needs to import the header files:
You can access and use pieces of code written in C and Objective-C from within your Swift code. After you import an Objective-C framework, a C library, or a header file, you can work with Objective-C classes and protocols, as well as common C constructs, functions, and patterns.
https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis
So I imagine it's just a matter of translating Nim to C and use the header files in Swift without the need of a framework/library.
I think this would be possible. The GC and memory management between nim, c, and switch would be a constant pain point. You would have to export c style structures. It might even make sense to write the header file in C as glue and have both nim and swift use it.
One use-case I can see is some thing like a network/database support lib that can run on all platforms while UI is drawing natively with Swift on iOS or Java on Android.
I would rather just write whole apps in nim though :)
The GC and memory management between nim, c, and switch would be a constant pain point. You would have to export c style structures. It might even make sense to write the header file in C as glue and have both nim and swift use it.
I will have time in a couple of weeks to try this. I was hoping someone would have tried already since Nim seems like the a perfect fit.
One use-case I can see is some thing like a network/database support lib that can run on all platforms while UI is drawing natively with Swift on iOS or Java on Android.
Yeah that's the idea, but for macOS and Windows.