Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PureSwift/GATT
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.3.0
Choose a base ref
...
head repository: PureSwift/GATT
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 5 commits
  • 5 files changed
  • 1 contributor

Commits on Jan 10, 2025

  1. Add OptionSet extension

    colemancda committed Jan 10, 2025
    Copy the full SHA
    72b61a7 View commit details
  2. Remove Xcode Cloud support

    colemancda committed Jan 10, 2025
    Copy the full SHA
    33e58a6 View commit details
  3. Update GitHub CI

    colemancda committed Jan 10, 2025
    Copy the full SHA
    9f5ccc3 View commit details
  4. Fixed ManufacturerSpecificData

    colemancda committed Jan 10, 2025
    Copy the full SHA
    4754fe9 View commit details

Commits on Jan 11, 2025

  1. Add Sendable conformance

    colemancda committed Jan 11, 2025
    Copy the full SHA
    28c1a5d View commit details
Showing with 39 additions and 10 deletions.
  1. +2 −2 .github/workflows/swift.yml
  2. +2 −2 Sources/GATT/AsyncStream.swift
  3. +30 −0 Sources/GATT/Extensions/OptionSet.swift
  4. +5 −4 Sources/GATT/ManufacturerSpecificData.swift
  5. +0 −2 ci_scripts/ci_post_clone.sh
4 changes: 2 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ jobs:
- name: Install Swift
uses: slashmo/install-swift@v0.3.0
with:
version: 6.0.2
version: 6.0.3
- name: Checkout
uses: actions/checkout@v2
- name: Swift Version
@@ -25,7 +25,7 @@ jobs:
name: Linux
strategy:
matrix:
swift: [6.0.2]
swift: [6.0.3]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
4 changes: 2 additions & 2 deletions Sources/GATT/AsyncStream.swift
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import Foundation
import Bluetooth

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
public struct AsyncCentralScan <Central: CentralManager>: AsyncSequence {
public struct AsyncCentralScan <Central: CentralManager>: AsyncSequence, Sendable {

public typealias Element = ScanData<Central.Peripheral, Central.Advertisement>

@@ -57,7 +57,7 @@ public extension AsyncCentralScan {
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
public struct AsyncCentralNotifications <Central: CentralManager>: AsyncSequence {
public struct AsyncCentralNotifications <Central: CentralManager>: AsyncSequence, Sendable {

public typealias Element = Central.Data

30 changes: 30 additions & 0 deletions Sources/GATT/Extensions/OptionSet.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// OptionSet.swift
// GATT
//
// Created by Alsey Coleman Miller on 1/10/25.
//

extension OptionSet {
@inline(never)
internal func buildDescription(
_ descriptions: [(Element, StaticString)]
) -> String {
var copy = self
var result = "["

for (option, name) in descriptions {
if _slowPath(copy.contains(option)) {
result += name.description
copy.remove(option)
if !copy.isEmpty { result += ", " }
}
}

if _slowPath(!copy.isEmpty) {
result += "\(Self.self)(rawValue: \(copy.rawValue))"
}
result += "]"
return result
}
}
9 changes: 5 additions & 4 deletions Sources/GATT/ManufacturerSpecificData.swift
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
public typealias ManufacturerSpecificData = GAPManufacturerSpecificData
#else
/// GATT Manufacturer Specific Data
public struct ManufacturerSpecificData<Data: DataConvertible>: Equatable, Hashable, Sendable {
public struct ManufacturerSpecificData <Data: DataContainer> : Equatable, Hashable, Sendable {

internal let data: Data // Optimize for CoreBluetooth / iOS

@@ -51,9 +51,10 @@ public extension ManufacturerSpecificData {
init(companyIdentifier: CompanyIdentifier,
additionalData: Data = Data()) {

var data = Data(capacity: 2 + additionalData.count)
withUnsafeBytes(of: companyIdentifier.rawValue.littleEndian) { data.append(contentsOf: $0) }
data.append(additionalData)
var data = Data()
data.reserveCapacity(2 + additionalData.count)
data += companyIdentifier.rawValue.littleEndian
data += additionalData
self.data = data
}
}
2 changes: 0 additions & 2 deletions ci_scripts/ci_post_clone.sh

This file was deleted.