我想在Objective-C项目中开始使用Swift.所以我添加了一个快速的类:
import Foundation
@objc class System : NSObject {
@objc func printSome() {
println("Print line System");
}
}
Run Code Online (Sandbox Code Playgroud)
并将其导入.m文件:
#import "MyProjectName-Swift.h"
在构建我的项目时,我收到以下错误:
Bridging header 'PathToMyProject/MyProjectName-Bridging-Header.h' does not exist
Run Code Online (Sandbox Code Playgroud)
注意:在"Build Settings-> Swift Compiler - Code Generation-> Objective-C Briding Header"下设置为MyProjectName-Bridging-Header.h
我该怎么做才能解决这个问题?
任何帮助深表感谢.
编辑:桥接头文件:#if defined(__ has_include)&& __has_include()#include #endif
#include <objc/NSObject.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if defined(__has_include) && __has_include(<uchar.h>)
# include <uchar.h>
#elif __cplusplus < 201103L
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
#endif
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define …Run Code Online (Sandbox Code Playgroud)