CutBox.app

Coverage Report

Created: 2024-03-12 03:40

.../Source/Extensions/Array+MenuItems.swift
Line
Count
Source (jump to first uncovered line)
1
//
2
//  Array+MenuItems.swift
3
//  CutBox
4
//
5
//  Created by jason on 11/9/23.
6
//  Copyright © 2023 ocodo. All rights reserved.
7
//
8
9
import Cocoa
10
11
extension Array where Element == NSMenuItem {
12
20
    func find(axID: String) -> CutBoxBaseMenuItem {
13
90
        guard let found = self.first(where: { $0.accessibilityIdentifier() == axID }),
14
20
              let cutboxMenuItem = found as? CutBoxBaseMenuItem
15
20
        else { fatalError("Could not located menu item: \(axID)") }
16
20
17
20
        return cutboxMenuItem
18
20
    }
19
}