diff --git a/.github/workflows/deploy-docc.yml b/.github/workflows/deploy-docc.yml new file mode 100644 index 0000000..bfb20c9 --- /dev/null +++ b/.github/workflows/deploy-docc.yml @@ -0,0 +1,46 @@ +name: Deploy DocC +on: + push: + branches: + - main +permissions: + contents: read + pages: write + id-token: write +concurrency: + group: "pages" + cancel-in-progress: true +jobs: + build: + name: Build DocC Documentation + runs-on: macOS-26 + env: + DEVELOPER_DIR: "/Applications/Xcode_26.1.app/Contents/Developer" + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Swift Version + run: xcrun swift --version + - name: Build DocC + run: | + xcrun swift build + xcrun swift package --allow-writing-to-directory ./docs \ + generate-documentation \ + --target BinaryParseKit \ + --output-path ./docs \ + --transform-for-static-hosting + - name: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: ./docs + deploy: + name: Deploy to GitHub Pages + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index c62b3f3..aec27b6 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,5 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots/**/*.png fastlane/test_output + +docs/ diff --git a/Package.resolved b/Package.resolved index 39f5a9d..4e7fc7c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "8bbc373bcf8db755460e717ab6cbb79a66408d9aee27c6d562fa53fe12e22529", + "originHash" : "9238a5eff43ac33dc7a148b7c3163fffc867bb0cb4bc7d811ac286cc2c3118d4", "pins" : [ { "identity" : "swift-binary-parsing", @@ -19,6 +19,24 @@ "version" : "1.1.6" } }, + { + "identity" : "swift-docc-plugin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-docc-plugin", + "state" : { + "revision" : "3e4f133a77e644a5812911a0513aeb7288b07d06", + "version" : "1.4.5" + } + }, + { + "identity" : "swift-docc-symbolkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swiftlang/swift-docc-symbolkit", + "state" : { + "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", + "version" : "1.0.0" + } + }, { "identity" : "swift-syntax", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 8edfd36..0b1098e 100644 --- a/Package.swift +++ b/Package.swift @@ -25,6 +25,7 @@ let package = Package( url: "https://github.com/apple/swift-collections.git", .upToNextMinor(from: "1.1.0"), ), + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.5"), ], targets: [ .macro( diff --git a/README.md b/README.md index 763b4c0..aa21b2f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A declarative Swift package for parsing binary data using macros, built on top of Apple's [`swift-binary-parsing`](https://github.com/apple/swift-binary-parsing) framework. > [!IMPORTANT] -> This package is currently under active development and its APIs are subjected to drastic changes. +> Warning: This package is currently under active development and its APIs are subjected to drastic changes. ## Features diff --git a/Sources/BinaryParseKit/Documentation.docc/Articles/Guide.md b/Sources/BinaryParseKit/Documentation.docc/Articles/Guide.md new file mode 120000 index 0000000..ff5c796 --- /dev/null +++ b/Sources/BinaryParseKit/Documentation.docc/Articles/Guide.md @@ -0,0 +1 @@ +../../../../README.md \ No newline at end of file diff --git a/Sources/BinaryParseKit/Documentation.docc/BinaryParseKit.md b/Sources/BinaryParseKit/Documentation.docc/BinaryParseKit.md new file mode 100644 index 0000000..7e21394 --- /dev/null +++ b/Sources/BinaryParseKit/Documentation.docc/BinaryParseKit.md @@ -0,0 +1,53 @@ +# ``BinaryParseKit`` + +A powerful Swift package for binary data parsing using macros and protocols. + +## Overview + +BinaryParseKit provides a convenient and type-safe way to parse binary data in Swift. It leverages Swift macros and protocols to automatically generate parsing logic for your data structures, making it easy to work with binary file formats, network protocols, and other binary data sources. + +## Topics + +### Articles + +- + +### Struct Parsing Macros + +- ``ParseStruct()`` +- ``parse()`` +- ``parse(byteCount:)`` +- ``parse(endianness:)`` +- ``parse(byteCount:endianness:)`` +- ``parse(byteCountOf:)`` +- ``parse(byteCountOf:endianness:)`` +- ``parseRest()`` +- ``parseRest(endianness:)`` +- ``skip(byteCount:because:)`` + +### Enum Parsing Macros + +- ``ParseEnum()`` +- ``match()`` +- ``match(byte:)`` +- ``match(bytes:)`` +- ``matchAndTake()`` +- ``matchAndTake(byte:)`` +- ``matchAndTake(bytes:)`` +- ``matchDefault()`` + +### Parsable Protocols + +- ``Parsable`` +- ``EndianParsable`` +- ``SizedParsable`` +- ``EndianSizedParsable`` + +### Matchable Protocols + +- ``Matchable`` +- ``MatchableRawRepresentable`` + +### Error + +- ``BinaryParserKitError`` diff --git a/Sources/BinaryParseKit/MatchableProtocols.swift b/Sources/BinaryParseKit/MatchableProtocols.swift index 08db8cf..6e5f41d 100644 --- a/Sources/BinaryParseKit/MatchableProtocols.swift +++ b/Sources/BinaryParseKit/MatchableProtocols.swift @@ -12,7 +12,6 @@ public protocol Matchable { /// A protocol for types that conform to `RawRepresentable` and `Matchable`. /// It provides a default implementation for `RawRepresentable` whose `RawValue` conforms to `Matchable`. -/// - SeeAlso: ``bytesToMatch()-1kmth`` public protocol MatchableRawRepresentable: RawRepresentable, Matchable {} /// Default implementation of `bytesToMatch()` for `MatchableRawRepresentable` where `RawValue` conforms to `Matchable`.