Posts

Post not yet marked as solved
4 Replies
3.2k Views
Hi, I am writing a Swift framework that primarily serves as a wrapper for a linear algebra library written in C. The framework therefore is a mixture of Swift and Objective C (the Objective C part is there to serve as a bridge to allow the Swift code to talk to the C I have reviewed the documents on Clang modules and looked at various code examples on the Web. However, I am still not finding a clear path and have had difficulties getting the code to compile (I am also unclear what the official recommendations are for achieving the goal I desire). Here are a few questions: 1) Is it good practice to create mixed languages frameworks that are a combination of Swift and Objective C++? If so, are there examples available that show best practices? If not, what is a workaround? 2) I don’t want to expose the Objective C++ part of the code to the consumer of my framework. I am not clear how to do this. I have read about private modules. However, I am unclear about how to properly use private modules in this context and again lack clear examples. 3) What is the recommended practice when creating module.map files in XCode when XCode itself generates a default module.map file when building a framework? Again, there are some examples on the Web, but I am unclear whether they are correct an none of them explicitly suits my goals. 4) Where is the official documentation on how to properly use module.map files in XCode especially with respect to building frameworks that rely on both Swift and Objective C++? 5) Although I know that if this weren’t a framework, I could create a bridging header to allow Swift to talk to Objective C++. However, in the case of a module there is an umbrella header. My understanding of the umbrella header is that it pertains to code that will consume the framework, not for other code in the framework itself. Can you somehow combine an umbrella header and a bridging header in a framework? Thanks in advance
Posted
by jon2718.
Last updated
.
Post not yet marked as solved
0 Replies
434 Views
Hi, A couple of questions regarding AnySubscriber in Combine. 1) Is it possible to call cancel on the subscription for an AnySubscriber? I don’t see any way to get the subscription object itself. 2) If there is a way to cancel the AnySubscriber does that also cause the wrapped subscriber (the non-type-erased subscriber) to also be cancelled? The reason I ask the 2nd question is that I’d like to reuse the original non-type-erased subscriber but as I understand once a subscription has been cancelled, you cannot use the subscriber to resubscribe. Please correct me if I am mistaken about this. Thank hyou. Jon
Posted
by jon2718.
Last updated
.
Post not yet marked as solved
0 Replies
840 Views
Hi,I am trying to build a very simple test for receiving input audio using AVAudioEngine in which the input node has the voice processing enabled on MacOS. I've seen examples for iOS, which make use of AVAudioSession, which is not available in MacOS. My code is quite simple and shown below. If I don't enable voice processing, I am able to start the engine. However, if I enable voice processing and then start the engine, I get a crash with the error: AUVPAggregate.cpp:1432:AUVoiceProcessor: couldn't create the aggregate device (err=-10876)Is there something I am missing? Do I need to perform other configuration on the input node to get this to work?Thanks so much in advance. class ViewController: NSViewController { private var audioEngine = AVAudioEngine() override func viewDidLoad() { super.viewDidLoad() setupAudioEngine() startaudioEngine() } func setupAudioEngine() { do { let input = audioEngine.inputNode do { try input.setVoiceProcessingEnabled(true) } catch { print("could not enable voice processing \(error)") return } } }
Posted
by jon2718.
Last updated
.