Juce wrapper for SwiftUI project

I’m attempting to create a SwiftUI project which can access an embedded Juce static library. I have no experience using Juce but am quite familiar with SwiftUI and iOS development. I’ve exported the library successfully using Projucer but haven’t been able to get the ObjC bridging layer working.

Are there any guides available on how to achieve this or am I attempting to solve this problem from the wrong angle. I have found an old example which mixes native UI elements with Juce components GitHub - adamski/juce-native-navigation: JUCE iOS and Android project to show integration of native API's and JUCE components but have not been able to find anything specific to SwiftUI.

Thanks

@jbhydric I have fairly extensive experience with this kind of setup. If you check this repo there is an example of using a JUCE library project in an iOS Xcode project

1 Like

@adamwilson the embedded juce library appears to compile ok, but the client app is returning this error on compilation:

Undefined symbols for architecture arm64:
OBJC_CLASS$_DemoAudioEngineBindings”, referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any suggestions as to what the cause of this may be? Have tried both default and legacy build systems.

I’m seeing the same thing as you in Xcode 12. It’s been a while since I looked at this project. Looks like it’s not linking the library, but I’ve not worked out what setting is required to make that happen again. I’ll report back if I find the issue!

1 Like

Hey Adam

Did you manage to get anything figured out with this? I’m about to get started having a go with the same sort of mix, so would be good to know before I dive deep.

Best

No, I haven’t made time for it, been absorbed in plugin development! I’m sure its a simple fix, as it’s been working well in previous versions of Xcode.

I’ll have a bit more of a look then and report back

Undefined symbols for architecture arm64

Are you using an Intel-based Mac and compiling to run in the simulator? If so, you need a version of your JUCE library compiled for x86. It’s possible to create an xcframework that bundles both the x86 and arm64 versions of your library, and Xcode can figure out which one to use.

Or are you running on an iOS device or in the simulator on one of the newer Apple M1-based Macs? Because those are built on an arm64 architecture. If that’s the case, I don’t know what’s going on.