Skip to content

docs: expand README (requirements, installation, API reference) - #5

Merged
ronaldmannak merged 2 commits into
mainfrom
claude/gallant-fermat-80btpw
Jun 17, 2026
Merged

ronaldmannak merged 2 commits into
mainfrom
claude/gallant-fermat-80btpw

Conversation

@ronaldmannak

Copy link
Copy Markdown
Contributor

Summary

Docs-only. The README already described the v2 async/observable API at a high level; this fills the gaps for someone adopting the package. No source changes — every API reference was checked against the merged main source.

What changed

  • Requirements section: Swift 6 / Xcode 16, supported platforms (macOS 14 / iOS 17 / tvOS 17 / visionOS 1), and the minimum Pico AI Homelab version.
  • Installation expanded with concrete SwiftPM steps (Xcode "Add Package Dependencies…" and a Package.swift snippet), a note that import BonjourPico re-exports the core discovery types, and the version-pinning caveat (see below). The former "Xcode Settings" is folded into a Configure your Xcode project subsection (now also mentions the iOS multicast entitlement).
  • Usage section: quick-start (SwiftUI), a BonjourPico API table, a BonjourEndpoint field table, an endpointStream() async-sequence example, notes on automatic retry / the observable state, advanced Configuration, and the BonjourPicoError surface.
  • Added a table of contents; documented the incomplete-advertisement filtering and the stable-id (ServerIdentifier) contract.

Note on versioning

The repo's only tag is 0.0.1 (pre-v2), so the install instructions depend on the main branch. Since v2 is breaking, cutting a 2.0.0 release would let consumers pin a version — happy to help with that separately.

Testing

Documentation only; no build/behavior impact.

🤖 Generated with Claude Code

https://claude.ai/code/session_011r15hkWqTdtMV4TeAgrqn8


Generated by Claude Code

The README already covered the v2 async/observable API at a high level; this
fills the gaps for someone adopting the package:

- Add a Requirements section (Swift 6 / Xcode 16, supported platforms, the
  minimum Pico AI Homelab version).
- Expand Installation with concrete SwiftPM steps (Xcode "Add Package
  Dependencies" and a Package.swift snippet) and note the single re-exporting
  import; fold the former "Xcode Settings" into a "Configure your Xcode
  project" subsection and mention the iOS multicast entitlement.
- Add a Usage section with a quick-start, a BonjourPico API table, a
  BonjourEndpoint field table, an endpointStream() async-sequence example,
  notes on automatic retry / the `state` property, advanced configuration,
  and the BonjourPicoError surface.
- Add a table of contents and document the incomplete-advertisement filtering
  and the stable `id` (ServerIdentifier) contract.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011r15hkWqTdtMV4TeAgrqn8

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly expands the README.md documentation for the BonjourPico package, adding detailed sections on requirements, installation, Xcode configuration, API references, and usage examples. The review feedback suggests making the API signatures in the reference table more precise and idiomatic, and adjusting the async stream example to obtain the stream before starting the scan to prevent missing initial discovery events.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread README.md Outdated
Comment on lines +176 to +180
| `startScanning()` | `async throws` | Starts a scan. Idempotent while already scanning. Throws `BonjourPicoError` if the browser can't start. |
| `stopScanning()` | `async` | Stops scanning and clears `endpoints`. |
| `endpointStream()` | `async -> AsyncThrowingStream<[BonjourEndpoint], Error>` | An async-sequence alternative to the observable `endpoints` (see below). |
| `wake(_:)` | `async throws` | Sends a Wake-on-LAN magic packet to an endpoint (see [Wake-on-LAN](#wake-on-lan)). |
| `init(configuration:)` | — | Creates the facade, optionally with a custom discovery configuration (see [Advanced configuration](#advanced-configuration)). |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The signatures in the BonjourPico API table can be made more precise and idiomatic to Swift by including the parameter types and explicit return types where applicable. This helps developers understand the API contract at a glance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cab85a0. The API table now lists full idiomatic declarations — func startScanning() async throws, func wake(_ endpoint: BonjourEndpoint) async throws, func endpointStream() async -> AsyncThrowingStream<[BonjourEndpoint], Error>, private(set) var endpoints: [BonjourEndpoint], init(configuration: BonjourDiscoveryActor.Configuration = .init()), etc. — instead of bare type fragments, so the contract (and the read-only/observable nature of the properties) is clear at a glance.


Generated by Claude Code

Comment thread README.md
Comment on lines +205 to +210
try await bonjourPico.startScanning()

let stream = await bonjourPico.endpointStream()
for try await endpoints in stream {
print("Discovered \(endpoints.count) server(s)")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure that no initial discovery events are missed, it is more robust to obtain the async stream before calling startScanning(). Although the underlying implementation replays the current state upon subscription, setting up the stream first is a safer and more standard pattern for working with asynchronous streams.

Suggested change
try await bonjourPico.startScanning()
let stream = await bonjourPico.endpointStream()
for try await endpoints in stream {
print("Discovered \(endpoints.count) server(s)")
}
let stream = await bonjourPico.endpointStream()
try await bonjourPico.startScanning()
for try await endpoints in stream {
print("Discovered \(endpoints.count) server(s)")
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cab85a0 — adopted the suggestion. The example now obtains the stream before startScanning(). As you noted, the actor replays the current snapshot on subscribe (and yields full snapshots, not deltas, so nothing is actually missed either way), but subscribing first is the safer, more standard pattern and makes the example a good template for streams in general. Added a one-line comment explaining the ordering.


Generated by Claude Code

- BonjourPico API table now shows full idiomatic declarations (func/var/init
  with parameter names, types, and explicit return types) instead of bare
  type fragments.
- endpointStream() example now obtains the stream before startScanning(), the
  safer/standard async-sequence pattern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011r15hkWqTdtMV4TeAgrqn8

Copy link
Copy Markdown
Contributor Author

@codex review

Docs-only PR (README expansion) — CI is green on cab85a0. It also folds in Gemini's two suggestions (idiomatic API-table declarations and obtaining endpointStream() before startScanning()). Please review the latest commit.


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: cab85a087f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ronaldmannak
ronaldmannak merged commit c8dece5 into main Jun 17, 2026
1 check passed
@ronaldmannak
ronaldmannak deleted the claude/gallant-fermat-80btpw branch June 17, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants