I want to integrate below Framework to my swift project so that I can use LibSSH dynamic port forwarding within my swift app
Here is github repo of Object C framework https://github.com/mconintet/SDF
My project is just a simple WKWebView
app in Swift
I am very new to this situation can someone please guide me some solution
The most easy way without digging to deep into settings is..
In your Swift project create one Objective-C Class (.m
+.h
) file, the naming is not important. This file will be needed anyway so you can code more in objective-c for your project.
When you are asked to generate Bridging Header
, say yes.
In the generated Projectname-Bridging-Header.h
(not your own created file)
place your #import <SDF/SDF.h>
rule.
Compile once.
Start programming in swift with your ObjC stuff.
Alternative: go into your target settings or project settings and search for "bridging" and change the parameters as you need.
There is (A) one way bridging to swift and (B) one way auto generated bridging into objective-c. Both name conventions can be edited but only one Projectname-Bridging-Header.h
will be visible in your project file tree. The other one Projectname-Swift.h
is repeatedly generated from Xcode for you. If you try to expose functions from Swift to Objective-C, this "invisible" header file needs to be imported as well, but in the Objective-C file you need it via #import "Projectname-Swift.h"
.