Skip to content

Commit 29926bc

Browse files
authored
Merge pull request #15 from StarryInternet/docs
Add support for swift package index auto-docc-generation and add some doc comments too
2 parents 6ca8939 + 1239c01 commit 29926bc

6 files changed

Lines changed: 71 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ on:
1616

1717
jobs:
1818
build-mac:
19-
runs-on: macos-latest
19+
runs-on: macos-12
2020
steps:
2121
- uses: actions/checkout@v2
2222
- name: Build
23-
run: swift build
23+
run: swift build --build-tests
2424
- name: Run tests
25-
run: swift test
25+
run: swift test --skip-build
2626
- name: Pod lint
2727
run: pod lib lint --quick
2828
- name: Verify Carthage
2929
run: carthage build --no-skip-current --verbose --use-xcframeworks --platform macOS
3030

3131
build-ios:
32-
runs-on: macos-latest
32+
runs-on: macos-12
3333
steps:
3434
- uses: actions/checkout@v2
3535
- name: Build

.spi.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets: [CombineCoreBluetooth]

CombineCoreBluetooth.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ import PackageDescription
55

66
let package = Package(
77
name: "CombineCoreBluetooth",
8-
platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)],
8+
platforms: [
9+
.iOS(.v13),
10+
.macOS(.v10_15),
11+
.tvOS(.v13),
12+
.watchOS(.v6),
13+
],
914
products: [
1015
.library(
1116
name: "CombineCoreBluetooth",
1217
targets: ["CombineCoreBluetooth"]
1318
),
1419
],
15-
dependencies: [],
20+
dependencies: [
21+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
22+
],
1623
targets: [
1724
.target(
1825
name: "CombineCoreBluetooth",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,87 @@
11
import CoreBluetooth
22
import Foundation
33

4+
/// Various kinds of data that are advertised by peripherals and obtained by the ``CentralManager`` during scanning.
45
public struct AdvertisementData {
56
let dictionary: [String: Any]
67

8+
/// Initializes the advertisement data with the given dictionary, ideally obtained from `CoreBluetooth` itself.
9+
/// - Parameter dictionary: The advertisement data dictionary that backs all the properties of this type.
710
public init(_ dictionary: [String: Any] = [:]) {
811
self.dictionary = dictionary
912
}
1013

14+
/// Initializes the advertisement data with the given dictionary, ideally obtained from `CoreBluetooth` itself.
15+
/// - Parameter dictionary: The advertisement data dictionary that backs all the properties of this type.
1116
public init(_ dictionary: [Key: Any]) {
1217
self.dictionary = Dictionary(uniqueKeysWithValues: dictionary.map({ (key, value) in
1318
(key.rawValue, value)
1419
}))
1520
}
1621

22+
/// The local name of a peripheral
1723
public var localName: String? {
1824
dictionary[Key.localName.rawValue] as? String
1925
}
2026

27+
/// The transmit power of a peripheral.
2128
public var txPowerLevel: Double? {
2229
(dictionary[Key.txPowerLevel.rawValue] as? NSNumber)?.doubleValue
2330
}
2431

32+
/// An array of advertised service UUIDs of a peripheral
2533
public var serviceUUIDs: [CBUUID]? {
2634
dictionary[Key.serviceUUIDs.rawValue] as? [CBUUID]
2735
}
2836

37+
/// A dictionary that contains service-specific advertisement data.
2938
public var serviceData: [CBUUID: Data]? {
3039
dictionary[Key.serviceData.rawValue] as? [CBUUID: Data]
3140
}
3241

42+
/// Manufacturer data of a peripheral
3343
public var manufacturerData: Data? {
3444
dictionary[Key.manufacturerData.rawValue] as? Data
3545
}
3646

47+
/// An array of UUIDs found in the overflow area of the advertisement data.
3748
public var overflowServiceUUIDs: [CBUUID]? {
3849
dictionary[Key.overflowServiceUUIDs.rawValue] as? [CBUUID]
3950
}
4051

52+
/// A Boolean value that indicates whether the advertising event type is connectable.
4153
public var isConnectable: Bool? {
4254
(dictionary[Key.isConnectable.rawValue] as? NSNumber)?.boolValue
4355
}
4456

57+
// An array of solicited service UUIDs.
4558
public var solicitedServiceUUIDs: [CBUUID]? {
4659
dictionary[Key.solicitedServiceUUIDs.rawValue] as? [CBUUID]
4760
}
4861

62+
/// Keys that may reference data in the ``AdvertisementData`` obtained by searching for peripherals.
4963
public struct Key: Equatable, Hashable {
5064
public let rawValue: String
5165

5266
private init(_ rawValue: String) {
5367
self.rawValue = rawValue
5468
}
5569

70+
/// Key referencing the local name of a peripheral. Wrapper around `CBAdvertisementDataLocalNameKey` in `CoreBluetooth`
5671
public static let localName: Key = .init(CBAdvertisementDataLocalNameKey)
72+
/// Key referencing the transmit power of a peripheral. Wrapper around `CBAdvertisementDataTxPowerLevelKey` in `CoreBluetooth`
5773
public static let txPowerLevel: Key = .init(CBAdvertisementDataTxPowerLevelKey)
74+
/// Key referencing an array of advertised service UUIDs. Wrapper around `CBAdvertisementDataServiceUUIDsKey` in `CoreBluetooth`
5875
public static let serviceUUIDs: Key = .init(CBAdvertisementDataServiceUUIDsKey)
76+
/// Key referencing a dictionary that contains service-specific advertisement data. Wrapper around `CBAdvertisementDataServiceDataKey` in `CoreBluetooth`
5977
public static let serviceData: Key = .init(CBAdvertisementDataServiceDataKey)
78+
/// Key referencing the manufacturer data of a peripheral. Wrapper around `CBAdvertisementDataManufacturerDataKey` in `CoreBluetooth`
6079
public static let manufacturerData: Key = .init(CBAdvertisementDataManufacturerDataKey)
80+
/// Key referencing an array of UUIDs found in the overflow area of the advertisement data. Wrapper around `CBAdvertisementDataOverflowServiceUUIDsKey` in `CoreBluetooth`
6181
public static let overflowServiceUUIDs: Key = .init(CBAdvertisementDataOverflowServiceUUIDsKey)
82+
/// Key referencing a boolean value that indicates whether the advertising event type is connectable. Wrapper around `CBAdvertisementDataIsConnectable` in `CoreBluetooth`
6283
public static let isConnectable: Key = .init(CBAdvertisementDataIsConnectable)
84+
/// Key referencing an array of solicited service UUIDs. Wrapper around `CBAdvertisementDataSolicitedServiceUUIDsKey` in `CoreBluetooth`
6385
public static let solicitedServiceUUIDs: Key = .init(CBAdvertisementDataSolicitedServiceUUIDsKey)
6486
}
6587
}

0 commit comments

Comments
 (0)