Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 PanoromaView.h and PanoromaView.m 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 'PanoramaView'

and

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.

Thanks

EDIT:

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

like image 611
Henry Brown Avatar asked May 08 '16 13:05

Henry Brown


1 Answers

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.setImageWithName("park_2048.jpg")
        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) {
        panoramaView.draw()
    }
}

This is my sample app:

https://github.com/melifaro-/Swift-PanoramaSample

Hope it helps.

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

like image 68
Igor B. Avatar answered Sep 21 '22 10:09

Igor B.