I remember in old Xcode there was option under Create New Project there was option to create BSD Dynamic Library - dylib. However now I see only Cocoa Framework, Static Library and Metal Library.
Any hints?
I remember in old Xcode there was option under Create New Project there was option to create BSD Dynamic Library - dylib. However now I see only Cocoa Framework, Static Library and Metal Library.
Any hints?
You may create a project for an iOS static lib, and create a dynamic lib from the static one with a custom build phase with the following command:
xcrun --sdk iphoneos clang -arch <ARCH> -shared -all_load \
-o lib<NAME>.dylib lib<NAME>.a
where <ARCH> is either armv7 or arm64 and <NAME>is the base name of your lib. You may check or list the architectures with file command. E.g.:
file <path>/lib<NAME>.a`
lib<NAME>.a (for architecture armv7): current ar archive random library
lib<NAME>.a (for architecture arm64): current ar archive random library
If more than one architecture is listed, Xcode has produced a universal static library. In this case you may create a universal shared library with multiple -arch flags:
xcrun --sdk iphoneos clang -arch armv7 -arch arm64 -shared -all_load \
-o lib<NAME>.dylib lib<NAME>.a
You may need to specify additional linker flags (e.g. -l for linking non-standard libs).