Create C++ static library with Swift interoperability for iOS. How?

Hello all!

My application written with C++ for iOS. Want to make some functionality in static library for the purpose of reuse it in different C++ projects. Want to make universal library for using StoreKit2. Global idea is to wrap StoreKit2 Swift out with CPP interoperability.

Now trying to make clear for my self how to create C++ static library with Swift interoperability for iOS in XCode. There are only Objective-C option when you creating static library in XCode for iOS. Is it correct:

  1. Create Static Library with Objective-C in XCode
  2. Remove all default Objective-C files
  3. Add C++ files
  4. Add C++/Swift interoperability in build settings
  5. Add swift classes

Beside all of it some questions:

  • When C++ static library contain Swift code with interoperability will it require some special settings for project (Swift standard lib or some other settings)? Or it could be used like any other C++ libraries?
  • What is the optimal build settings in this case to reduce dependencies when using it different projects?
  • Is there any examples of the same approach for iOS development?
Create C++ static library with Swift interoperability for iOS. How?
 
 
Q