import Foundation enum RDEPUBSelectionState: Equatable { case idle case selecting(anchor: Int) case selected(RDEPUBSelection) case committingAction(RDEPUBSelection, action: RDEPUBAnnotationMenuAction) var hasSelection: Bool { switch self { case .idle: return false case .selecting, .selected, .committingAction: return true } } var selection: RDEPUBSelection? { switch self { case .idle, .selecting: return nil case .selected(let selection), .committingAction(let selection, _): return selection } } }