Skip to content

Migrate from BitMaskOptionSet to native OptionSet#53

Merged
colemancda merged 9 commits into
feature/code-coveragefrom
feature/optionset-migration
Jul 18, 2026
Merged

Migrate from BitMaskOptionSet to native OptionSet#53
colemancda merged 9 commits into
feature/code-coveragefrom
feature/optionset-migration

Conversation

@colemancda

Copy link
Copy Markdown
Member

Summary

Replaces the deprecated BitMaskOptionSet / BitMaskOption (both marked @available(*, deprecated, message: "Use OptionSet instead") in the Bluetooth package) with native Swift OptionSet structs. This clears every BitMaskOptionSet is deprecated warning in the build.

Each flag enum + BitMaskOptionSet<Flag> pair becomes a single OptionSet struct, keeping the original type name so public API and the DocC references stay intact — the same idiom the Bluetooth package uses for its own flag types (e.g. CTEType).

Type Before After
RFCOMMFlag enum: BitMaskOption struct: OptionSet (UInt32)
RFCOMMLinkMode enum: BitMaskOption struct: OptionSet (UInt16)
HCIDeviceFlag enum: BitMaskOption (bit positions) struct: OptionSet (UInt32, 1<<n masks)
HostController.ScanOption enum: BitMaskOption struct: OptionSet (UInt16)

HCIDeviceOptions.flags / contains were rewritten to OptionSet semantics (intersection(.all) / isSuperset(of:)). This also fixes a latent bug: the old BitMaskOptionSet<HCIDeviceFlag> could not represent .up (bit position 0 collapsed to "empty"), so options.flags silently dropped it — the native OptionSet masks (1<<n) represent it correctly.

Verification

  • Debug build: clean, zero BitMaskOptionSet deprecation warnings
  • Debug tests: all pass
  • Release (library) build: passes

Base branch

Targets feature/code-coverage rather than master: this branch was cut from it and depends on that branch's Bluetooth-master API fixes (.dataData(_:), updated UUID namespaces) to build against the current Bluetooth dependency. It will retarget to master automatically once #52 merges.

@colemancda
colemancda merged commit 860a46e into feature/code-coverage Jul 18, 2026
1 check passed
@colemancda
colemancda deleted the feature/optionset-migration branch July 18, 2026 02:52
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.

1 participant