objective-cswiftxcodeheaderxlpagertabstrip

Cannot find interface declaration in myproject-swift.h


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


Solution

  • 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