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

Aleem
  • 3,173
  • 5
  • 33
  • 71
  • "open in new xcode and added few swift classes" Within framework? – Dileep Jan 20 '17 at 07:39
  • Is there a swift header file? Refer to this http://stackoverflow.com/a/24102880/742298 – Ashutosh Dave Jan 20 '17 at 07:39
  • @Dili I am created my own framework, and before it was only in objective c now I added few swift files – Aleem Jan 20 '17 at 07: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 – Aleem Jan 20 '17 at 07:43

1 Answers1

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

yageek
  • 4,115
  • 3
  • 30
  • 48