Henry Brown Henry Brown - 2 years ago 162
Swift Question

Errors after importing Obj-C files through bridging header

I am trying to import this project into my swift project. What I have done is add the

files, and added
#import "PanoramaView.h"
to my bridging header. I have also added the OpenGLES.framework and GLKit.Framework to my project.

I am now getting errors saying

Cannot find interface declaration for 'GLKView', superclass of


Unknown type name 'GLKVector3'

This is an image of the errors in the code:

enter image description here

If anybody can help explain what these are how I remove them that would be great.



I have also tried installing through Cocoapods and still get the exact same errors, very strange?

Answer Source

In order to make it work, I had to add this into PanoramaView.h:

#import <GLKit/GLKit.h>

Suggested on the github code does not work for me from the box. Also I had to modify ViewController:

import UIKit

class ViewController: GLKViewController {

    var panoramaView = PanoramaView()

    override func loadView() {
        panoramaView.touchToPan = true          // Use touch input to pan
        panoramaView.orientToDevice = false     // Use motion sensors to pan
        panoramaView.pinchToZoom = true         // Use pinch gesture to zoom
        panoramaView.showTouches = true         // Show touches
        self.view = panoramaView

    override func glkView(view: GLKView, drawInRect rect: CGRect) {

This is my sample app:


Hope it helps.

BTW, I did not use CocoaPods. I use PanoramaView.h and PanoramaView.m files only.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download