6
votes

I' m using XLPagerTabStrip pod in my project,

i have a bridging header for other purposes to integrate from swift to objective c myproject-swift.h

i cant build the project and this error always pops:

Cannot find interface declaration for 'ButtonBarPagerTabStripViewController', superclass of 'ParentViewController'

enter image description here

This is my Controller

import Foundation
import UIKit
import XLPagerTabStrip

class ParentViewController: ButtonBarPagerTabStripViewController {

    override func viewDidLoad() {
        tabStripStyle()
        super.viewDidLoad()
        containerView.isScrollEnabled = false
    }
   } 

I have seen this issue everywhere posted but its not yet answered here: 'Cannot find interface declaration' in auto-generated Swift bridging header

Bugs in swift SR-805 SR-5398

1
Is myproject-swift.h a bridging header that shows up in your project and contains Objective-C declarations for use by Swift? Or is it Xcode-generated interface header (not listed as part of your project) containing declarations for use by Objective-C, so it can make use of your Swift code? If it's the latter, then it should not be called a bridging header. Just trying to understand your use of terminology. - Anatoli P
its an auto generated interface which contains Objective-C declarations for use by Swift @AnatoliP - Sanad Barjawi
Where's ButtonBarPagerTabStripViewController declared, and how? - Cristik
@Cristik its from a pod - Sanad Barjawi
And how about ParentViewController? How is that declared in Swift? Please add all the relevant information into the question, this will make it easier for people to understand the problem. - Cristik

1 Answers

5
votes

You needed to import the -Swift.h for for both the framework and the app target

For Example :

    #import <UIKit/UIKit.h>
    #import <AVFoundation/AVFoundation.h>
    #import <Foundation/Foundation.h>
    #import "XLPagerTabStrip-Swift.h"
    #import "RealmSwift-Swift.h"
    ...... // Add all frameworks, subclasses, and dependance ios frameworks
    #import  "MyProject-Swift.h"

You can read this article How to import file header and check paths