Skip to content

Commit 1b9e9a0

Browse files
kylebrowningJeremy Chiang
authored andcommitted
Update Bluejay and dependencies to Swift 5 (#200)
* Update Bluejay to Swift 5 * Update dependecies to Swift 5 * Use Swift 5 for Bluejay Heart Sensor Demo as well * Adopt Xcode recommended project settings * Use Swift 5 for Dittojay Heart Sensor Demo as well * Bump Bluejay version and Swift version markers * Update documentation to note Swift 5 and Xcode 10.2.1 as new requirements
1 parent 1a7c530 commit 1b9e9a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1004
-716
lines changed

Bluejay.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'Bluejay'
3-
spec.version = '0.8.4'
3+
spec.version = '0.8.5'
44
spec.license = { type: 'MIT', file: 'LICENSE' }
55
spec.homepage = 'https://github.com/steamclock/bluejay'
66
spec.authors = { 'Jeremy Chiang' => 'jeremy@steamclock.com' }
77
spec.summary = 'Bluejay is a simple Swift framework for building reliable Bluetooth apps.'
88
spec.homepage = 'https://github.com/steamclock/bluejay'
9-
spec.source = { git: 'https://github.com/steamclock/bluejay.git', tag: 'v0.8.4' }
9+
spec.source = { git: 'https://github.com/steamclock/bluejay.git', tag: 'v0.8.5' }
1010
spec.source_files = 'Bluejay/Bluejay/*.{h,swift}'
1111
spec.framework = 'SystemConfiguration'
1212
spec.platform = :ios, '10.0'
1313
spec.requires_arc = true
14-
spec.dependency 'XCGLogger', '~> 6.1.0'
15-
spec.swift_version = '4.2'
14+
spec.dependency 'XCGLogger', '~> 7.0.0'
15+
spec.swift_version = '5.0'
1616
end

Bluejay/.jazzy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ output: ../docs
22
author: Steamclock Software
33
author_url: http://steamclock.com
44
module: Bluejay
5-
module_version: 0.8.4
5+
module_version: 0.8.5
66
readme: ../README.md
77
sdk: iphone
88
copyright: Copyright © 2017 Steamclock Software. All rights reserved.

Bluejay/Bluejay.xcodeproj/project.pbxproj

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@
569569
B8383B5C21C3162800F07306 = {
570570
CreatedOnToolsVersion = 10.1;
571571
DevelopmentTeam = GH868RP95T;
572+
LastSwiftMigration = 1020;
572573
ProvisioningStyle = Automatic;
573574
SystemCapabilities = {
574575
com.apple.BackgroundModes = {
@@ -579,6 +580,7 @@
579580
B87FDD5D21E567150010D6CF = {
580581
CreatedOnToolsVersion = 10.1;
581582
DevelopmentTeam = GH868RP95T;
583+
LastSwiftMigration = 1020;
582584
ProvisioningStyle = Automatic;
583585
SystemCapabilities = {
584586
com.apple.BackgroundModes = {
@@ -589,14 +591,14 @@
589591
B8C70F741E1C22850006CF58 = {
590592
CreatedOnToolsVersion = 8.2.1;
591593
DevelopmentTeam = GH868RP95T;
592-
LastSwiftMigration = 1010;
594+
LastSwiftMigration = 1020;
593595
ProvisioningStyle = Automatic;
594596
};
595597
};
596598
};
597599
buildConfigurationList = B8C70F6F1E1C22850006CF58 /* Build configuration list for PBXProject "Bluejay" */;
598600
compatibilityVersion = "Xcode 3.2";
599-
developmentRegion = English;
601+
developmentRegion = en;
600602
hasScannedForEncodings = 0;
601603
knownRegions = (
602604
en,
@@ -669,7 +671,7 @@
669671
files = (
670672
);
671673
inputPaths = (
672-
"${SRCROOT}/Pods/Target Support Files/Pods-BluejayHeartSensorDemo/Pods-BluejayHeartSensorDemo-frameworks.sh",
674+
"${PODS_ROOT}/Target Support Files/Pods-BluejayHeartSensorDemo/Pods-BluejayHeartSensorDemo-frameworks.sh",
673675
"${BUILT_PRODUCTS_DIR}/ObjcExceptionBridging/ObjcExceptionBridging.framework",
674676
"${BUILT_PRODUCTS_DIR}/XCGLogger/XCGLogger.framework",
675677
);
@@ -680,7 +682,7 @@
680682
);
681683
runOnlyForDeploymentPostprocessing = 0;
682684
shellPath = /bin/sh;
683-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BluejayHeartSensorDemo/Pods-BluejayHeartSensorDemo-frameworks.sh\"\n";
685+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-BluejayHeartSensorDemo/Pods-BluejayHeartSensorDemo-frameworks.sh\"\n";
684686
showEnvVarsInLog = 0;
685687
};
686688
A3B0253955770A9E58E075E5 /* [CP] Check Pods Manifest.lock */ = {
@@ -720,7 +722,7 @@
720722
files = (
721723
);
722724
inputPaths = (
723-
"${SRCROOT}/Pods/Target Support Files/Pods-DittojayHeartSensorDemo/Pods-DittojayHeartSensorDemo-frameworks.sh",
725+
"${PODS_ROOT}/Target Support Files/Pods-DittojayHeartSensorDemo/Pods-DittojayHeartSensorDemo-frameworks.sh",
724726
"${BUILT_PRODUCTS_DIR}/ObjcExceptionBridging/ObjcExceptionBridging.framework",
725727
"${BUILT_PRODUCTS_DIR}/XCGLogger/XCGLogger.framework",
726728
);
@@ -731,7 +733,7 @@
731733
);
732734
runOnlyForDeploymentPostprocessing = 0;
733735
shellPath = /bin/sh;
734-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DittojayHeartSensorDemo/Pods-DittojayHeartSensorDemo-frameworks.sh\"\n";
736+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DittojayHeartSensorDemo/Pods-DittojayHeartSensorDemo-frameworks.sh\"\n";
735737
showEnvVarsInLog = 0;
736738
};
737739
E74B2676FBABC2E126DD9A0D /* [CP] Check Pods Manifest.lock */ = {
@@ -911,7 +913,7 @@
911913
PRODUCT_BUNDLE_IDENTIFIER = com.steamclock.BluejayHeartSensorDemo;
912914
PRODUCT_NAME = "$(TARGET_NAME)";
913915
PROVISIONING_PROFILE_SPECIFIER = "";
914-
SWIFT_VERSION = 4.2;
916+
SWIFT_VERSION = 5.0;
915917
TARGETED_DEVICE_FAMILY = 1;
916918
};
917919
name = Debug;
@@ -937,7 +939,7 @@
937939
PRODUCT_BUNDLE_IDENTIFIER = com.steamclock.BluejayHeartSensorDemo;
938940
PRODUCT_NAME = "$(TARGET_NAME)";
939941
PROVISIONING_PROFILE_SPECIFIER = "";
940-
SWIFT_VERSION = 4.2;
942+
SWIFT_VERSION = 5.0;
941943
TARGETED_DEVICE_FAMILY = 1;
942944
};
943945
name = Release;
@@ -963,7 +965,7 @@
963965
MTL_FAST_MATH = YES;
964966
PRODUCT_BUNDLE_IDENTIFIER = com.steamclock.DittojayHeartSensorDemo;
965967
PRODUCT_NAME = "$(TARGET_NAME)";
966-
SWIFT_VERSION = 4.2;
968+
SWIFT_VERSION = 5.0;
967969
TARGETED_DEVICE_FAMILY = 1;
968970
};
969971
name = Debug;
@@ -988,7 +990,7 @@
988990
MTL_FAST_MATH = YES;
989991
PRODUCT_BUNDLE_IDENTIFIER = com.steamclock.DittojayHeartSensorDemo;
990992
PRODUCT_NAME = "$(TARGET_NAME)";
991-
SWIFT_VERSION = 4.2;
993+
SWIFT_VERSION = 5.0;
992994
TARGETED_DEVICE_FAMILY = 1;
993995
};
994996
name = Release;
@@ -1128,7 +1130,7 @@
11281130
PRODUCT_NAME = "$(TARGET_NAME)";
11291131
SKIP_INSTALL = YES;
11301132
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1131-
SWIFT_VERSION = 4.2;
1133+
SWIFT_VERSION = 5.0;
11321134
};
11331135
name = Debug;
11341136
};
@@ -1151,7 +1153,7 @@
11511153
PRODUCT_BUNDLE_IDENTIFIER = com.steamclock.Bluejay;
11521154
PRODUCT_NAME = "$(TARGET_NAME)";
11531155
SKIP_INSTALL = YES;
1154-
SWIFT_VERSION = 4.2;
1156+
SWIFT_VERSION = 5.0;
11551157
};
11561158
name = Release;
11571159
};

Bluejay/Bluejay.xcodeproj/xcshareddata/xcschemes/Bluejay.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Bluejay/Bluejay.xcodeproj/xcshareddata/xcschemes/BluejayHeartSensorDemo.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Bluejay/Bluejay/Bluejay.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ extension Bluejay: CBCentralManagerDelegate {
12521252
for observer in self.connectionObservers {
12531253
observer.weakReference?.bluetoothAvailable(false)
12541254
}
1255+
@unknown default:
1256+
debugLog("New system level CBCentralManager state added.")
12551257
}
12561258
}
12571259

@@ -1290,6 +1292,8 @@ extension Bluejay: CBCentralManagerDelegate {
12901292
precondition(connectingPeripheral == nil && connectedPeripheral == nil,
12911293
"Connecting and connected peripherals are not nil during willRestoreState for state: disconnected.")
12921294
disconnectedPeripheralAtRestoration = peripheral
1295+
@unknown default:
1296+
debugLog("New system level CBCentralManager state added.")
12931297
}
12941298
}
12951299

Bluejay/Bluejay/CBManagerState+ReturnString.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ extension CBManagerState {
2121
case .unauthorized: return "Unauthorized"
2222
case .unknown: return "Unknown"
2323
case .unsupported: return "Unsupported"
24+
@unknown default:
25+
return "Unknown"
2426
}
2527
}
2628

Bluejay/Bluejay/CBPeripheralState+ReturnString.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ extension CBPeripheralState {
1818
case .connecting: return "Connecting"
1919
case .disconnected: return "Disconnected"
2020
case .disconnecting: return "Disconnecting"
21+
@unknown default:
22+
return "Unknown"
2123
}
2224
}
2325

Bluejay/Bluejay/CharacteristicIdentifier.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,14 @@ public struct CharacteristicIdentifier {
5050
}
5151
}
5252

53-
extension CharacteristicIdentifier: Equatable {
53+
extension CharacteristicIdentifier: Hashable {
5454
/// Check equality between two CharacteristicIdentifiers.
5555
public static func == (lhs: CharacteristicIdentifier, rhs: CharacteristicIdentifier) -> Bool {
5656
return (lhs.uuid == rhs.uuid) && (lhs.service.uuid == rhs.service.uuid)
5757
}
58-
}
59-
60-
extension CharacteristicIdentifier: Hashable {
6158
/// The hash value of the `CBUUID`.
62-
public var hashValue: Int {
63-
let cHashValue = uuid.hashValue
64-
let sHashValue = service.uuid.hashValue
65-
return (cHashValue << 5) &+ cHashValue &+ sHashValue
59+
public func hash(into hasher: inout Hasher) {
60+
hasher.combine(uuid)
61+
hasher.combine(service.uuid)
6662
}
6763
}

Bluejay/Bluejay/Data+Extractable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension Data {
2222
throw BluejayError.dataOutOfBounds(start: start, length: length, count: self.count)
2323
}
2424

25-
return self.subdata(in: start..<start + length).withUnsafeBytes { $0.pointee }
25+
return self.subdata(in: start..<start + length).withUnsafeBytes { $0.load(as: T.self) }
2626
}
2727

2828
}

0 commit comments

Comments
 (0)