Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/deploy-docc.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

docs/
20 changes: 19 additions & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
53 changes: 53 additions & 0 deletions Sources/BinaryParseKit/Documentation.docc/BinaryParseKit.md
Original file line number Diff line number Diff line change
@@ -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

- <doc:Guide>

### 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``
1 change: 0 additions & 1 deletion Sources/BinaryParseKit/MatchableProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down