OptionSet子类-是否可能

时间:2018-10-18 16:15:47

标签: swift bitmask optionsettype

我想对正在实现class的{​​{1}}进行子类化,以便仅为此OptionSet添加一些额外的options。这可能吗?我尝试过这样的事情:

subclass

但是当我尝试使用extension AugmentedRealityViewSceneKit { public class EngineConfiguration: OptionSet { public static let enableSun = EngineConfiguration(rawValue: 1 << 0) public static let enableFloor = EngineConfiguration(rawValue: 1 << 1) public var rawValue: Int required public init(rawValue: RawValue) { self.rawValue = rawValue } } } extension AugmentedRealityViewARKit { public class EngineConfiguration: AugmentedRealityViewSceneKit.EngineConfiguration { public static let enableWorldTracking = EngineConfiguration(rawValue: 1 << 2) public static let enableEnvironmentLightEstimation = EngineConfiguration(rawValue: 1 << 3) public static let enableFloorLevelDetection = EngineConfiguration(rawValue: 1 << 4) } } 检查选项是否在给定集中时,此方法不起作用-它显示:

  

'AugmentedRealityViewARKit.EngineConfiguration'需要以下类型   'AugmentedRealityViewARKit.EngineConfiguration'和   'AugmentedRealityViewSceneKit.EngineConfiguration'等效于   使用“包含”

示例游乐场:

.contains()

0 个答案:

没有答案