Error importing unknown type in iOS

I tried to include the fast ViewController file in the Objective-C project, but I canโ€™t do it, it shows an error, for example an unknown name like import , how to solve this problem, please, any help for this problem.

Here I post my code and ScreenShot.

import UIKit
@objc class SigViewController2: UIViewController {

@IBOutlet weak var cameraBtn: UIButton!

@IBOutlet weak var imageBtn: UIButton!

@IBOutlet weak var settingsBtn: UIButton!

@IBOutlet weak var mediaBtn: UIButton!


override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view, typically from a nib.
}
override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(true)
    navigationController?.navigationBarHidden = false

    self.navigationItem.title = "Main";
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

    // Only allow Portrait
    return UIInterfaceOrientationMask.Portrait
}

override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {

    // Only allow Portrait
    return UIInterfaceOrientation.Portrait
}

enter image description here

+4
source share
2 answers

For developers who are still looking for an answer.
Importing a file Swiftinternally Objective-ccan cause this error if it is not imported properly.


Look at the error first.

enter image description here

Try the KJTreeObjC.Swiftfile below Objective-C ViewController.

enter image description here


Decision:

.
/ Swift Objective-C . .

Objective-C Generated Interface Header Name Targets -> Build Settings.
enter image description here

Import.
, .

enter image description here

+6

. objective-c. objective-c, :

#import "MyClass.swift"

.h, :

@class MyClass.swift;

.

0

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


All Articles