Can't reference framework .h header files from my Swift controller - ios

I'm trying to import a framework made up of Objective-C header files.
I've created a bridging file but when I try to import a header the compiler doesn't recognise it.
This is error Xcode is showing:
Also if I try to reference the Framework in my Swift file as import ArcGIS it doesn't recognise that either.
What am I doing wrong?

You dont have to import ArcGIS header file. Guess you have used Carthage or CocoaPods. The only thing you need is to import ArcGIS
Check the documentation here
https://developers.arcgis.com/ios/swift/guide/install.htm

Related

SWIFT_OBJC_BRIDGING_HEADER in Swift Package Manager

I am trying to utilize an Objective-C framework inside the Swift package. For this, I would need to import the headers something like
#import<Framework/header.h>
Traditionally this can be achieved via bridging header. How can I set the bridging header via package manager settings?
This is bit tricky. You cannot import Objective-C framework's header files directly into SPM as you cannot write import statement such that #import<Framework/header.h>
The only feasible way is, write swift interface for your header files in Framework and then you would be able to import all methods. It can be done with module map as referred here

Xcode - Import the XCUIElement.h into bridging header

This post discusses how to reopen an application in XCTest using the resolve function: Possible to bring the app from background to foreground?
It mentions that you need to import the XCUIElement.h into the bridging header. Can someone please give details on what this means and how to accomplish this?
I created the Bridging-Header.h and copied in the XCUIElement.h:
Added the import to the Bridging file:
Error:
I changed the import statement with the file, but then get all these other errors so I'm not sure if I did that right:

Objective c and Swift using in Framework in Xcode

I've my own old framework which is only compatible in objective c, but Now I open in new xcode and added few swift classes (Xcode not gave me option to create bridging as this do in normal App when you add swift class in objective c project), Also Xcode gave me suggestion to update build setting and I updated those and currently I'm on Xcode 8.2.1. Now I try to build but I am getting few error as you can see in picture . I googled and found solution to delete derive data and quite xcode and open and clean. I done Everything but didn't workout.
Is bridging can be possible in framwork.
If not possible then how can I achieve.
Need help and suggestion.
When you are mixing Swift/Objc inside a framework, you can import Swift code for Objective-C use and import Objective-C from Swift.
First, ensure that Define Settings is set for the current framework target.
To import Swift into Objective-C:
In each Objective-C file that requires the Swift code, import the generated Swift header with the complete current Framework Path : #import <Framework/Framework-Swift.h>
To import Objective-C into Swift:
Ensure you have an umbrella header. The path can be found inside the Build Settings of the target. In this header, import all the needed Objective-C headers like normally in Objective-C: #import "Header"
Source: https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-ID122

Import RNCryptor to project

I try to import RNCryptor to my project to encrypt some string. But I have trouble to understand how to import that to my objective-c project. I copied the RNCryptor/RNCryptor.swift and RNCryptor.h by drag and drop in to my project. Then it "created a bridging header". After that I tried to debug but I have 38 error messages like: Use of unresolved identifier 'kCCKeySizeAES256' or Use of unresolved identifier 'CCPBKDFAlgorithm'. How can I fix that and how would I use it in a viewController.h file? Normally with #import "RNCryptor.h"
https://github.com/RNCryptor/RNCryptor#obj-c
I think you need to add #import "RNCryptor/RNCryptor.h" to the bridging header file, did you do that?
See the RNCryptor Swift branch
The Bridging Header
CommonCrypto is not a modular header in Xcode 7. This makes it very challenging to import into Swift. To work around this, the necessary header files have been copied into RNCryptor.h, which needs to be bridged into Swift. You can do this either by using RNCryptor as a framework, adding #import "RNCryptor/RNCryptor.h" to your existing bridging header, or making RNCryptor/RNCryptor.h your bridging header in Build Settings, "Objective-C Bridging Header."

How can I import firefox-ios to my obj-C project

I wonder how can I import https://github.com/mozilla/firefox-ios to my existing Obj-C project. While it does not a framework, I could not import sources of it in my Obj-C project files when I added the project into workspace. I tried to convert it to a static library, but I could not figured it out. I have a little bit experience on Swift and this creating static library thing. Actually, I am not sure this is the right way to do.
Thanks
You should check the Apples documentation about using Swift in Objective-c.(The Importing Swift into Objective-C part)
You can add a Swift-module header and import your .swift files and use them in your objective-c code.

Resources