Swift: Error when trying to import UIKit Swift: Error when trying to import UIKit xcode xcode

Swift: Error when trying to import UIKit


This problem usually happens when you try to import ".swift" file in your Objective-C code, like this: #import "HomeViewController.swift". This is wrong and you should import special, automatically generated Swift header, instead:

#import "ProductModuleName-Swift.h"

where ProductModuleName is the name of your module (or project) containing the Swift code.


The import stuff in swift is case sensitive. Example :

import uikit

will not work. You'll have to type it as

import UIKit