cannot find AudioEngine in scope - audiokit

Briefly, I have installed AudioKit XCFramework, imported AudioKit into a simple class and, as per migration guide, tried to create an instance of Audio engine instead of the old 4.0 AudioKit singleton.
Steps
1: made frameworks folder , pasted AudioKit XCFramework into it
2: embedded and signed AudioKit in project settings
3: updated other linker flags to include -lc++
4: updated framework search paths to include path to Audiokit
5: Wrote simple class with code below
import AudioKit
class AkStart {
var mix = AKMixer()
init(){
let engine = AudioEngine()
engine.output = mix
engine.start()
}
}
I get an error preventing compilation reading: "cannot find 'AudioEngine' in scope"
my Xcode version is 12.3, Im using SwiftUI, and AudioKit XCFramework AudioKit version at time of writing 5.0
Are there additional input statements or steps in the framework installation that I also need to include?

I think all of your questions would be answered by watching the Office Hours I've posted to YouTube: https://www.youtube.com/channel/UCLLYNAal3aJpaFl4WluRCvw
And feel free to join in the next one. I post the link on the AudioKitMan twitter feed.

Related

“Unresolved Identifier” error SparkSetupMainController()” custom Particle Photon Swift iOS app (Standard Particle documentation procedure)

Hello there,
I’m trying to connect my Particle Photon with a custom Swift iOS app. I’m writing code in Swift and use the official Particle iOS development documentation as my guidance.
(https://docs.particle.io/guide/how-to-build-a-product/mobile-app/)
All the SDK’s are within my Xcode project and ready to be used. The SDK installation process via CocoaPods didn’t show any errors or ploblems.
I had to create an UIButton (startDeviceSetup) and added some code that (I think) asks for functions within Particle’s SDK.
Code given by Particle in their documentation:
#IBAction func startDeviceSetup(sender: AnyObject) {
var setupController = SparkSetupMainController()
self.presentViewController(setupController, animated: true, completion: nil)
}
After creating and connecting my UIButton and entering the following code. Xcode gives me an Unresolved Identifier error when I’m trying to make a build:
Unresolved Identifier error
The internet tells me that “Unresolved Identifier” seems to be a common error that often have something to do with Target memberships or classes that aren’t public. Unfortunately I can’t figure out the location of my problem. I strictly followed Particles documentation and did nothing different.
Additional information
I’m using Xcode 8.0, iOS 10 and Swift 3. I installed Particles SDK’s using CocoaPods. As described in the official Particle documentation. I created a new UIButton within my main.storyboard and connected it as an action to my ViewController etc.
Also Imports like this “import Spark-SDK” didn't make any difference.
Thank you for reading my question,
I’m still searching for an answer. It would be greatly appreciated if someone could help me :)
Somehow Xcode fixed itself. I just reinstalled it. Importing Spark-SDK and SparkSetup in my ViewController works fine now.
You need to create a bridge from your swift project to pods file. In other word you need to create a header file

SceneKit SCNNode init(mdlObject:) missing?

I'm using Xcode 7.3.1, Swift 2.x, iOS target is 9.3. I can find convenience init init(MDLObject mdlObject: MDLObject) in Apple docs, but I don't see it in my project. I opened standard game project starter, SceneKit is imported. I've tried:
Double checking iOS version
Adding import ModelIO
Finding "mdlObject:" in header files in SceneKit.framework - not found
Looking for alternative methods (maybe Apple moved it somewhere) but there are no other inits with that parameter, no class function, nor I found any corresponding export function in MDLObject
Cleaning project...
I can see all SceneKit classes, and I can create MDLAsset (part of ModelIO, can return MDLObjects) instance.
Any ideas, maybe I've overlooked something obvious?
the following should do
import SceneKit.ModelIO

Does Swift support WebRTC?

Our team is in process of electing programming language to develop a new iOS application in which we have to write features to support video conversation.
The backend is written using WebRTC, now we have to decide which language to use in the iPhone app and we prefer Swift in this case.
However, I'm not sure Swift supports WebRTC or not.
My initial research show that we can implement the features using Objective-C. I found an example written in Objective-C which you can find the source code here.
However, I'm not sure about Swift. Does Swift also support WebRTC?
UPDATE 2023
Unfortunately, as of 2023 there still appears to be no completely Swift framework that implements the WebRTC protocol. Although the iOS framework hosted at webrtc.org can be fairly easily used in Swift apps, it is written mostly in objective C.
For those stumbling on this question, who just want to get webRTC running in your app this is still relatively easy using the cocoapod
UPDATE 2016
The easiest way is to get webRTC in your project is to simply install the CocoaPod using the directions at https://cocoapods.org/pods/WebRTC
If you have never used CocoaPods before you will need to first follow this guide: https://guides.cocoapods.org/using/getting-started.html
Original Answer
The simple answer to the question is that there are currently no open source libraries written in Swift conforming to the WebRTC protocol. You can still compile the code from the official WebRTC project into your app. Directions which may not lead to a successful build can be found here: https://webrtc.org/native-code/ios/
Finally, to clarify Omkar Guhilot's answer: Skylink is a company with a closed source SDK that is designed to work only with their paid stun-turn service, and https://github.com/alongubkin/phonertc requires cordova, which may not be ideal for many native ios developers.
Webrtc comes with Objective C interface. I dont think they will move to swift interface anytime soon. But You can always use them via bridging headers. I have written apprtc (webrtc's demo) in swift 2.3 version with help of bridging headers in github link with a description in this blog . I have planned to write 3.0 version and a swift wrappers over it.
Current version of webrtc framework doesn't require any pods or any extra bridging headers.
The framework can be generated by following instructions on this Link :
https://webrtc.github.io/webrtc-org/native-code/ios/
If you follow them correctly you will generate a framework add that framework in your project and follow the webrtc necessary steps and you will have a WEBRTC integrated project.
To know what all steps are necessary follow this link from appear.in
:
https://tech.appear.in/2015/05/25/Getting-started-with-WebRTC-on-iOS/
This will get you to a stage where you will be able to make calls between a browser and any iOS 8+ device
Yes swift supports WebRTC and there is one more library which you can use in swift link:- http://skylink.io/ios/
And the link that you have shared to which is written in Objective C, we should be able to use that as well in swift by creating a Bridging header
Have a look at this as well https://github.com/alongubkin/phonertc
Thanks
Omkar

Swift: How do you use an Objective-C function from a linked library?

Background
I'm new to iOS development and playing with Swift for the sake of learning. As a small challenge, I'm trying to get the SSID of network to which a device is currently connected.
This is well-covered ground on Stack using Objective-C: iPhone get SSID without private library, for example ... but the Objective-C / Swift dance is causing me some conceptual challenges.
Specifically, the suggested solution (discussed in the above-linked post) is to call the function CNCopyCurrentNetworkInfo() -- but, according to Apple's documentation, this function is not available in Swift.
So far
I've included (I think correctly) SystemConfiguration.framework by adding it to the Linked Frameworks and Libraries of the project. I've also brought it into the View Controller using import SystemConfiguration.
Questions
Do I need to also use import SystemConfiguration, or is that already done due to including the framework with my project?
Is there another / better way to include the SystemConfiguration library?
The big one: How, once the required library is imported, do you call the Objective-C function from the library?
Thank you!
I know this is not directly answering your question, but it's an answer to your problem.
You can do everything in swift in your case.
After importing the library,
import SystemConfiguration.CaptiveNetwork
You can immediately call:
CNCopySupportedInterfaces()
and it will work.
Confirmed in Xcode 6.3.2.
Apple's interoperability book (from Understanding the Swift Import Process):
Any Objective-C framework (or C library) that’s accessible as a module
can be imported directly into Swift. This includes all of the
Objective-C system frameworks—such as Foundation, UIKit, and
SpriteKit—as well as common C libraries supplied with the system.
Regarding your specific questions:
The opposite is the case: you do not need to manually include Apple's frameworks. Xcode will automatically make them available to you given a valid import statement (such as import SystemConfiguration in your case), even – or rather: especially – in a playground!
ditto...
Given the above import statement, SystemConfiguration is indeed imported since you can call its functions (e.g. SCCopyLastError() // --> __NSCFError) and access its constants (e.g. kCFErrorDomainSystemConfiguration // --> com.apple.SystemConfiguration). Unfortunately, CaptiveNetwork does not seem to be imported with it (e.g. CNCopySupportedInterfaces() // --> Use of unresolved identifier).
You should be able, however, to use this framework on the Objective C side and simply call your own wrapper functions from Swift. You just need to remember to include them among the imports listed in your bridging header (see Swift and Objective-C in the Same Project for more about bridging headers).

How to create and use an iOS Framework for sharing code with Extensions

How does the minimal setup and usage of a custom iOS framework look like? I starting to look into this in order to share code with a Today Extension.
Here's what I did so far
Added a new Target choosing the Cocoa Touch Framework template and called it TesterKit
Inside the framework I created a new class TestClass.swift
Inside TestClass.swift I created a simple class method class fund tester() printing a string for testing
Looking at my app I can see that TesterKit has been added as Embedded Binaries and Linked Frameworks and Libraries, however it is red
In order to use this new Framework in the app, I added import TesterKit to the top of my AppDelegate
Then I tried to call the class method from the Framework using TestClass.tester(). But instead of showing the log message I get a …
"Use of unresolved identifier"
→ What am I doing wrong? Any wrong assumptions here?
Note: I already watched the WWDC sessions 416 "Building Modern Frameworks" and found the Framework Programmign Guide. If there are any example projects showing how to use such new custom iOS Frameworks, ideally using Swift + integrating this with Today Extensions, that might be helpful, too.
It seems like your import is not failing which means the framework is actually set up correctly...try making the function public.
public func tester() { print("tester()" }

Resources