1

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. enter image description here

4
  • "open in new xcode and added few swift classes" Within framework? Commented Jan 20, 2017 at 7:39
  • Is there a swift header file? Refer to this stackoverflow.com/a/24102880/742298 Commented Jan 20, 2017 at 7:39
  • @Dili I am created my own framework, and before it was only in objective c now I added few swift files Commented Jan 20, 2017 at 7:41
  • @AshutoshDave No I don't have any swift file "ProjectName-Swift.h", I think this create because of bridging suggestion which I didn't get while adding new swift file Commented Jan 20, 2017 at 7:43

1 Answer 1

2

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

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

1 Comment

Awesome. Critical point here was that "Framework-Swift.h" did not work, it has to be imported using <Framework/Framework-Swift.h>.

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.