diff --git a/.github/workflows/periphery.yml b/.github/workflows/periphery.yml new file mode 100644 index 0000000..75491e5 --- /dev/null +++ b/.github/workflows/periphery.yml @@ -0,0 +1,20 @@ +name: Periphery + +on: + push: + branches: [main] + pull_request: + +jobs: + periphery: + name: Run Periphery + runs-on: macos-26 + steps: + - uses: actions/checkout@v6 + - uses: SwiftyLab/setup-swift@latest + with: + swift-version: "6.2" + - name: Install Periphery + run: brew install periphery + - name: Run Periphery + run: periphery scan diff --git a/.periphery.yml b/.periphery.yml new file mode 100644 index 0000000..85b884a --- /dev/null +++ b/.periphery.yml @@ -0,0 +1 @@ +retain_public: true diff --git a/Sources/SwiftCIFP/CIFP.swift b/Sources/SwiftCIFP/CIFP.swift index a0b0aba..b9ae127 100644 --- a/Sources/SwiftCIFP/CIFP.swift +++ b/Sources/SwiftCIFP/CIFP.swift @@ -30,9 +30,6 @@ import Foundation /// use ``linked()`` to create a ``CIFPData`` actor. public struct CIFP: Sendable, Codable { - /// Estimated number of records for pre-allocation. - private static let estimatedRecordCount = 400_000 - /// The file header information. public let header: Header diff --git a/Sources/SwiftCIFP/Parser/CIFPByteParser.swift b/Sources/SwiftCIFP/Parser/CIFPByteParser.swift index 1d2c15a..0368b21 100644 --- a/Sources/SwiftCIFP/Parser/CIFPByteParser.swift +++ b/Sources/SwiftCIFP/Parser/CIFPByteParser.swift @@ -117,20 +117,6 @@ struct ApproachContinuationRecord: Sendable { /// Parser for CIFP fixed-width records. struct CIFPByteParser: Sendable { - /// Standard CIFP record length. - static let recordLength = 132 - - /// Common field positions (0-indexed). - private static let fields = ( - recordType: 0..<1, - customerArea: 1..<4, - sectionCode: 4..<6, - airportIdent: 6..<10, - icaoRegion: 10..<12, - fileRecordNumber: 123..<128, - cycleDate: 128..<132 - ) - /// Parse a single record line. static func parseRecord( _ bytes: ArraySlice, diff --git a/Sources/SwiftCIFP/Types/BearingRange.swift b/Sources/SwiftCIFP/Types/BearingRange.swift index dddf5d7..55c9f8c 100644 --- a/Sources/SwiftCIFP/Types/BearingRange.swift +++ b/Sources/SwiftCIFP/Types/BearingRange.swift @@ -141,18 +141,6 @@ extension BearingRange { public static var fullCircle: BearingRange { BearingRange(from: 0, to: 360) } - - /// Creates a bearing range from a standard Range. - init(_ range: Range) { - self.init(from: range.lowerBound, to: range.upperBound) - } - - /// Creates a bearing range from a ClosedRange. - /// - /// Note: The upper bound is treated as exclusive for consistency. - init(_ range: ClosedRange) { - self.init(from: range.lowerBound, to: range.upperBound) - } } // MARK: - Measurement Support diff --git a/Sources/SwiftCIFP/Types/ByteInitializable.swift b/Sources/SwiftCIFP/Types/ByteInitializable.swift index e101258..19bf24e 100644 --- a/Sources/SwiftCIFP/Types/ByteInitializable.swift +++ b/Sources/SwiftCIFP/Types/ByteInitializable.swift @@ -11,16 +11,3 @@ extension ByteInitializable { self.init(rawValue: Character(UnicodeScalar(byte))) } } - -/// Protocol for String-based enums that can be initialized from ASCII bytes. -protocol StringByteInitializable: RawRepresentable where RawValue == String { - init?(bytes: some RandomAccessCollection) -} - -extension StringByteInitializable { - /// Initialize from ASCII bytes. - init?(bytes: some RandomAccessCollection) { - guard let string = String(bytes: Array(bytes), encoding: .utf8) else { return nil } - self.init(rawValue: string.trimmingCharacters(in: .whitespaces)) - } -} diff --git a/Sources/SwiftCIFP/Types/Common/RecordType.swift b/Sources/SwiftCIFP/Types/Common/RecordType.swift index f083d90..b41e599 100644 --- a/Sources/SwiftCIFP/Types/Common/RecordType.swift +++ b/Sources/SwiftCIFP/Types/Common/RecordType.swift @@ -11,29 +11,3 @@ enum RecordType: Character, Sendable, Codable, CaseIterable, ByteInitializable { /// Tailored record. case tailored = "T" } - -/// Customer/area code (positions 2-4). -enum CustomerAreaCode: String, Sendable, Codable, CaseIterable { - /// United States. - case usa = "USA" - - /// Canada. - case canada = "CAN" - - /// Pacific. - case pacific = "PAC" - - /// Continuation record (blank). - case continuation = " " - - /// Initialize from bytes, handling the "S " pattern for continuation records. - init?(bytes: T) where T.Element == UInt8, T.Index == Int { - let str = bytes.toString() - if str.isEmpty { - self = .continuation - } else { - guard let code = Self(rawValue: str) else { return nil } - self = code - } - } -}