Swift: error while trying to import UIKit

I get this strange error when trying to import UIKit into my quick file.

My code is simple:

import UIKit

class Test: NSObject {

}

The error I get in 'import UIKit':

  • Unknown type name 'import'
  • Expected ';' after the top level announcement

I added UIKit to my Frameworks folder, the class does not contain any code (therefore there shouldn’t be anything bad), and I tried restarting xCode and my Mac, but the error is still there.

I appreciate any help.

Thanks.

EDIT: Solved:

I tried to import "Test.swift" into AppDelegate.

+5
source share
3 answers

".swift" Objective-C, : #import "HomeViewController.swift". , , Swift:

#import "ProductModuleName-Swift.h"

ProductModuleName - ( ), Swift.

+19

swift . :

import uikit

.

import uikit
0

Source: https://habr.com/ru/post/1623259/


All Articles