I have an Obj-C Project I'm trying to migrate to Swift. I did succeed with various classes but recently ran into an issue I can't seem to make sense of. When I try to compile my current code base I get the following (SUPER UNHELPFUL ERROR MESSAGE)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
My only assumption is its somehow related to my bridging-headers but Xcode isn't giving me enough information to figure out if this is actually true.
I'm using Cocoapods
to add the CorePlot
to my project. I'm trying to migrate the following class to Swift:
#import <Foundation/Foundation.h> @class CPTScatterPlot; @interface ScatterPlotContainer : NSObject @property (nonatomic, strong) CPTScatterPlot *ahrsAlt; @property (nonatomic, strong) CPTScatterPlot *calibration; @property (nonatomic, strong) CPTScatterPlot *coreAlt; @property (nonatomic, strong) CPTScatterPlot *pitch; @property (nonatomic, strong) CPTScatterPlot *roll; @property (nonatomic, strong) CPTScatterPlot *slip; @end
#import <CorePlot/CPTScatterPlot.h> #import "ScatterPlotContainer.h" @implementation ScatterPlotContainer { } @end
import Foundation class ScatterPlotContainer : NSObject { public var ahrsAlt : CPTScatterPlot; public var calibration : CPTScatterPlot; public var coreAlt : CPTScatterPlot; public var pitch : CPTScatterPlot; public var roll : CPTScatterPlot; public var slip : CPTScatterPlot; }
#import <CorePlot/CPTScatterPlot.h>
When I comment out the #import <CorePlot/CPTScatterPlot.h>
from the Bridging headers file - I get an error in swift because it doesn't know what CPTScatterPlot is
I've also tried #import <CPTScatterPlot.h>
which didn't work either.
So the only thing I can think of is perhaps because I'm using a cocoa pod there is some sort of module name I need to add. The error message really isn't that useful. Does anybody have a suggestion about some blaring error I've made or how to get a more descriptive error message to figure out what is going on?
I did the same all answer says but mine issue was not resolved. I did figured out that issue was related to broken function call.
A function syntax was not wrong but its calling mechanism was wrong.
To check the exact error for this issue check following:
Select issue navigator > Click on error will show logs for error > In that select All Messages tab.
This will show all detail logs for this error.
Scroll down and You got logs like, in my case
So, by reading this I figure out that something wrong with function calling. I browse my code and resolved it, Below was correct and wrong code.
Wrong Way:
var region = MKCoordinateRegionMake(self.mapView.userLocation.coordinate, span) // It will not shown error here but when you build project compiler shows error.
Right Way:
let region = MKCoordinateRegion(center: self.mapView.userLocation.coordinate, span: span)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With