“不能从非开放类继承"迅速 [英] "Cannot inherit from non-open class" swift
本文介绍了“不能从非开放类继承"迅速的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从Xcode 8 beta 6开始,我现在在其定义模块之外收到编译错误无法从非开放类(类)继承"
As of Xcode 8 beta 6 I now get the compile error "Cannot inherit from non-open class (Class)" outside of its defining module"
我继承的类是一个单独的Swift框架的一部分,但是我的项目针对Xcode 8 beta 5进行了编译.我需要更改什么才能使项目再次编译?
The class I was inheriting from was part of a separate Swift framework but my project compiled for Xcode 8 beta 5. What do I need to change to get my project to compile again?
推荐答案
我自己找到了答案.
在Swift 3中,您现在可以将一个类标记为open
而不是public
,这允许模块外部的文件对该类进行子类化.
In Swift 3 you can now mark a class as open
instead of public
this allows files outside of the module to subclass that class.
只需将模块类中的public
替换为open
.
Simply replace public
in your module class with open
.
参考此处.
这篇关于“不能从非开放类继承"迅速的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文