How to import DDMathParser in iOS 8 project? - swift

I am totally new to swift and developing my first application for iOS. I need to use DDMathParser with it. I followed guide at their site but i am getting errors at import statement
Expected identifier in import declaration
Expected expression
Import statement syntax:
#import "DDMathParser.h"
I followed This guide.

Bridging header files solved my problem. Thanks

Related

Integrating Microsoft Cognitive SpeechSDK framework into a Swift app

I'm trying to integrate Microsoft Bing Speech API with SpeechRecognitionService into my Swift application. Unfortunately, the Microsoft SDK only supports Objective-C atm, so I get around by adding #import "SpeechRecognitionService.h" to the Bridging Header after importing the SpeechSDK.framework, but I got the file not found error.
What am I doing wrong?
EDIT:
I did try import SpeechSDK framework directly into the needed class before but it was not working.
In my case, I'm still using the Bridging Header in order to import the framework. #import "SpeechRecognitionService.h" didn't work but a slight change as below works for me.
#import "SpeechSDK/SpeechRecognitionService.h"
There is no need to add header to bridging header, you can simply import the framework. From apple docs:
Importing External Frameworks
You can import external frameworks that have a pure Objective-C
codebase, a pure Swift codebase, or a mixed-language codebase. The
process for importing an external framework is the same whether the
framework is written in a single language or contains files from both
languages. When you import an external framework, make sure the
Defines Module build setting for the framework you’re importing is set
to “Yes”.
You can import a framework into any Swift file within a different
target using the following syntax:
import FrameworkName
See also “file not found” in Bridging Header when importing Objective-C frameworks into Swift project by CocoaPod
In my case, I'm still using the Bridging Header in order to import the framework. #import "SpeechRecognitionService.h" didn't work but a slight change as below works for me.
#import "SpeechSDK/SpeechRecognitionService.h"

Importing Contacts Framework in xcode7 , Swift2

Im trying to import contacts framework to my xcode7 , I have added the contacts framework from the build phases and I have declared
import UIKit
import Contacts
but it shows error saying /Users/anonymous/Desktop/Contacts/Contacts/ViewController.swift:10:8: Cannot import module being compiled
Yes try giving some different project name say"MyContactsDemo". it should work.
Note:posted in answer block as suggested by the person who questioned.
If your framework being embedded or linked against has the same name as your product/target... you will run into this issue with swift 2 & xcode 7 it seems. There are fixes mentioned above, but I'm adding this just to spell the problem out.

how to import bugsense in Swift

i can find its old implementation that is
#import <BugSense-iOS/BugSenseController.h>
and
[BugSenseController sharedControllerWithBugSenseAPIKey:#"123456" userDictionary:nil sendImmediately:YES]
and i am working in the Swfit Language
Import doesn't support dash (-)
can anyone update me how to import it in Swift, i also checked it on their bugsense documentation but couldn't find any updates
Create an ObjC bridging header help you to import it. First add the framework to your app directory and Xcode will ask you to create the bridging header.
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

How does importing within Swift work?

If I want to use Quartz and I type
import QuartzCore
for some reason, it works. If I type anything else, it doesn't work. When I check the documentation (Command click), it is a blank header file. How do I import headers?
As per the docs, import works for any Objective-C framework (or C library) that is accessible as a module.Objective-C frameworks vend APIs in header files. In Swift, those header files are compiled down to Objective-C modules, which are then imported into Swift as Swift APIs.

Weird including problems with AFNetwork?

I've just downloaded AFNetworking to try and mess with it, but i'm having weird errors on including it in my project.
I've just created an empty test project and dropped both AFNetworking and JSONKit in, and immediately i got the error "Lexical or Preprocessor Issue: 'AFNetworking/AFURLConnectionOperation.h' file not found" .
It happens in this row, but changing it to a regular import works for some reason. I could change all of them but I'm trying to understand why this is happening to begin with. I'm sure its some stupid configuration i didn't notice.
#import <AFNetworking/AFURLConnectionOperation.h> // Throws error
#import "AFURLConnectionOperation.h" // Works
Thanks ! :)
Shai
<AFNetworking/AFURLConnectionOperation.h> works if you add AFNetworking as a framework. If you added the files you have to replace the imports with just "AFURLConnectionOperation.h".
The '#import ' syntax is for framework import.
If you just drag&drop the source in your project you've to use '#import "AFURLConnectionOperation.h"'
If you want use a .framework this tutorial can help you: http://db-in.com/blog/2011/07/universal-framework-iphone-ios-2-0/