After upgrading Xcode to 7.3, I just found that some modules are stricken out while importing, like in this screenshot:
But after adding the module (so just pressing enter) everything is fine. What does that mean? The module here is written in Swift and works fine.
This is a bug. We have fixed it in 218010af, which should be included in the Swift 2.2.1 release and is included in the 2016-04-12-a developer snapshot.
The strikethrough occurs if you try to import a module that has already been imported by your file or module:
In this case, I have already imported Foundation (which implicitly imports CoreFoundation), so Xcode is telling you that there is no need to import either module again.
It usually happens when a framework is already imported by any other framework you have already been imported.
For example, UIKit is already imported with Foundation so you don't need to import it manually.
I changed the order of the imports
import Foundation
import UIKit
import LayerKit
import Atlas < red line
import Foundation
import UIKit
import Atlas
import LayerKit
Some notes that may be causing it:
LayerKit importing Atlas even though LayerKit is the lower level API
Atlas is the UI layer
Both were Cocoapod imports
Error appeared when I created an 2nd Schema for App Store/Enteprise
releases and cleaned one and switch to the other.
Deleting Derived
Data didnt clear it.
So tried rearranging them and red line disappeared
Related
previously I was using
"google.golang.org/api"=>v0.10.0
in my go.mod file and I was able to import
gensupport "google.golang.org/api/gensupport"
But with new
"google.golang.org/api"=>v0.103.0
I was unable to import gensupport and as I and my colleague have investigated, gensupport was shifted to
"google.golang.org/api/internal/gensupport"
but while using this import there is one error saying
Use of the internal package is not allowed
So now how I will be able to use gensupport with new "google.golang.org/api"=>v0.103.0 version.
Your only option is to vendor an older version of the library.
This package has been marked for internal use for a long time and was also marked to allow for breakages. See https://github.com/googleapis/google-api-go-client/issues/416 for options.
I am faced with a strange issue. I recently rebuilt my Xcode project file using a tool called Xcode gen, I now have hundreds of errors in my files related to imports, for example:
import Foundation
struct BillingHistoryDetailTableCellViewModel {
let contentColor: UIColor?
// Implementation
}
error: Cannot find type 'UIColor' in scope
Why am I suddenly faced with this error now? Xcode had no issue compiling this kind of file before.
Is there some kind of setting or flag required to fix this?
Answering this for others:
If your project happens to include objective-c code and the bridge file includes imports to frameworks that use UIKit then this will be imported globally across your project, hence Xcode not asking for the import in files where you reference objects in UIKit.
This seems kinda like a bad side effect of using an objective c bridge as it's easy to miss the adding the import statements.
I have a package collision where I get the following error:
mockgen -package=mocks -source=myproto.pb.go -destination=mocks/my_mocks.go
imported package collision: "foo" imported twice
I see one import that is obvious:
import foo "blah/blah/foo"
But I don't know where to start tracking down the duplicate import (nor where it is coming from). It seems strange to me that this is an issue as I am importing myproto.pb.go just fine, so I'm wondering if there is really an issue w/duplicate imports. Also, GoLand isn't showing any issues.
I'm hoping someone can point me in the direction of getting more information about where the duplicate import is coming form, checking if there is some issue and/or working around the issue.
This seems to be an ongoing issue. I just ran into it with it claiming "rand" was imported twice (even though my code doesn't import "rand").
The following workaround worked for me: Write down the list of interfaces in myproto.pb.go you wish to mock, and use "reflect mode" instead of "source mode"
mockgen -package=mocks -destination=mocks/my_mocks.go path.to/package/containing/myproto/pb/go [space-separated interface names]
should be equivalent to your previous invocation:
mockgen -package=mocks -source=myproto.pb.go -destination=mocks/my_mocks.go
but for some reason is more robust and does not trigger the double-import error.
Is there anything in swift that works like frameworks list in Xcode while using Obj-C? I want to know what modules I can use by default. e.g.. CoreData, CoreImage, etc.
Method - 1
To use any Objective-C Framework in Swift, you need to create 'Bridging-header.h" file and import your framework there to use anywhere in your swift project.
To add Bridging header in Swift Project
Method - 2
You can direct import any framework.
E.g. import CoreData
The main problem is that Xcode doesn't provide "AutoComplete" option for "import" statement so that's the problem as of now.
Reference: Import Framework in Swift Project, Xcode
Edited:
Most Popular List of Swift Modules which you can get from Xcode:
https://github.com/andelf/Defines-Swift
Let's say I have a file called myAppDelegate.swift and another called myWindowController.swift. How do I import myWindowController into myAppDelegate, because currently if I just type
import myWindowController
It says that it can't recognize that module. What's the step-by-step process for importing swift files into other swift files in Xcode6?
You don't need to import swift files in the same target into each other. The import statement is used for importing entire modules, not individual files. myWindowController should be accessible from myAppDelegate without needing to import.