I have a large project which I am currently attempting to refactor into a number of smaller projects that use frameworks to share code. I have built my first framework, and it's pretty simple. It is 100% Swift, so my only option is to use dynamic frameworks. The Swift classes and methods in my framework all have appropriate access levels (i.e., I have marked things public where they need to be), and I have a simple test project which builds and runs just fine.
I'm even in pretty good shape adding my framework to the parent project. I have a workspace with the main project and its dependencies (currently using CocoaPods for third party libraries, although I don't think that matters), and I add the framework project as a sub-project so that I get a good relative reference for building. I then add the framework to the parent project's Embedded Binaries. I can now import the library into a code file, and everything compiles - so far, so good.
I have trouble when I try to actually invoke code from the framework. When I am typing in the IDE, code completion and syntax highlighting work fine, but as soon as I compile, I get a build error: "use of unresolved identifier '[class name]'." For example:
import Foundation
import LKOUtilitiesLib
class TestImport {
func doSomething() {
// Error on the next line: Use of unresolved identifier 'UtilitiesAssembly'
if let switches = UtilitiesAssembly.featureSwitches {
debugPrint("Nio switch is \(switches.getSwitchValue("Nio"))")
}
}
}I feel as if I have tried everything - adding build settings for framework and header search paths, tweaking build phases and compile options for Swift and embedded binaries, etc. Project settings aren't noticeably different from the test project that works so well for me. One difference between this project and my test is that this project has an Apple Watch extension, but I tried adding that to the test and it worked fine.
Is there anywhere else I should look?
I can't share the parent project, but I don't mind sharing the framework, as it is still small and doesn't have anything proprietary. Here is a link: https://www.dropbox.com/s/79h9162qhlvyloj/utilities-ios.zip?dl=0
Thanks,
Matt