2

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

enter image description here

My project is just a simple WKWebView app in Swift

enter image description here

I am very new to this situation can someone please guide me some solution

1 Answer 1

2

The most easy way without digging to deep into settings is..

  1. 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.

  2. When you are asked to generate Bridging Header, say yes.

  3. In the generated Projectname-Bridging-Header.h (not your own created file)
    place your #import <SDF/SDF.h> rule.

  4. Compile once.

  5. 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".

Sign up to request clarification or add additional context in comments.

3 Comments

Seems I am near now.. One more silly question how can I put the SDF folder inside my project? I'm sorry I am so new to this
If you don't want to run into much trouble later you want to keep frameworks separated from your own code.. 1.) copy the framework into your project folder in Finder. 2.) Target settings > Frameworks,Libraries,...> + search for your framework >> select and add it. > write #import rule in code > compile. You can check if the framework is copied into your target under "build phases" > link & copy.
do't forget. SDF has its own dependencies as written in the git repo readme.md

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.