feat: Begins air handler measurement form
This commit is contained in:
21
Sources/StaticPressureFeature/FocusableField.swift
Normal file
21
Sources/StaticPressureFeature/FocusableField.swift
Normal file
@@ -0,0 +1,21 @@
|
||||
import Foundation
|
||||
|
||||
public protocol FocusableField {
|
||||
var next: Self? { get }
|
||||
}
|
||||
|
||||
extension FocusableField where Self: CaseIterable, Self: Equatable {
|
||||
|
||||
public var next: Self? {
|
||||
|
||||
guard let index = Self.allCases.firstIndex(of: self)
|
||||
else { return nil }
|
||||
|
||||
let endIndex = Self.allCases.endIndex
|
||||
let nextIndex = Self.allCases.index(after: index)
|
||||
|
||||
guard nextIndex < endIndex else { return nil }
|
||||
return Self.allCases[nextIndex]
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user