0

I have an older application made in Objective C. I want to add more features to it and I want to continue and write code in Swift (in which i'm new) from now on in this project.

I want to add this framework https://github.com/xmartlabs/XLPagerTabStrip and add some tabs using it. The tabs I want to add are some VC-s made in ObjectiveC.

I need to add some Swift code like shown below to the EmbeddedVC-s and I don't know how that is possible.

func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
    return IndicatorInfo(title: "My Child title")
  }

Is it possible to use this framework in my project?

Thanks! :)

victorholo
  • 95
  • 11
  • It is possible. You need to add a bridging header. This question already has answer here - http://stackoverflow.com/questions/24102104/how-to-import-swift-code-to-objective-c – KrishnaCA Nov 02 '16 at 20:17

1 Answers1

0

To add Swift into an Objective-C file, make sure to import "ProjectName-Swift.h" at the beginning of the Objective-C class. Remember to tag your Swift classes with @objc, or make sure the Swift class inherets from NSObject.

More info here: Can't use Swift classes inside Objective-C

Community
  • 1
  • 1
arthurpan
  • 16
  • 1