How to create a dylib for iOS project?

I want to create a dynamic library for my iOS project, which would be loaded at runtime.

In Xcode, there are templates available for creating a static/dynamic lib for MacOS. But under the iOS tab, there is only a "static library" template.

So, I used the "static library" template and in its build settings I changed the Mach-O type to "dynamic library".

Now after building it, I use the file command on the generated file and it tells me it is a dynamic lib.

But the generated file still has .a extension, which is usually for static libs.

I'm aware we can tell Xcode in build settings to change the .a extension to something else, say .dylib but this seems like a hacky way to create a dynamic library.

What is the correct way?

I am aware that standalone dylibs are not supported on iOS, and we need to wrap them in a framework.

For my use case, the framework will literally be a wrapper, it won't have any source files of its own. It should only contain the dynamic lib generated from some independent codebase. I am not sure how to place the dylib in the framework.

How to create a dylib for iOS project?
 
 
Q