Emm*_*der 5 import objective-c ios swift
我试图创建一个文件.swift来改变导航栏中的颜色但是当我试图在ViewController中导入File.swift时它会显示一个错误.
-------代码--------
//Esta clase se creo para dar color a la NavViewController por medio de su valor en RGB
import UIKit
class NavViewController: UINavigationController {
override func viewDidLoad() {
//Se divide el valor RGB entre 255.0
UINavigationBar.appearance().barTintColor = UIColor(red: 110/255.0, green: 192/255.0, blue: 238/255.0, alpha: 1.0)
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
Run Code Online (Sandbox Code Playgroud)
错误说:预期; 在顶级声明之后
您appName-Bridging-Header.h需要导入所需的 .h 文件,它们将在快速代码中可用
在 Objective-C 文件中,您需要导入module_name-Swift.h包含所有 swift 类的生成标头。这样,在 Objective c 中就可以使用 Swift 类了。
| 归档时间: |
|
| 查看次数: |
787 次 |
| 最近记录: |