rhummelmose / BluetoothKit

Easily communicate between iOS/OSX devices using BLE
Other
2.27k stars 267 forks source link

Adds Swift Package Manager support #100

Closed ricobeck closed 3 years ago

ricobeck commented 4 years ago

I just tried out the project but was a little scared by the amount of warning. So I reduced them down to one. The TODO in BKContinousScanner.swift:101 is still there.

ricobeck commented 4 years ago

I needed SPM for my project so maybe it's useful for others too.

DerekK19 commented 4 years ago

I added SPM support in my own branch too (https://github.com/DerekK19/BluetoothKit.git). My version does work - sorry I did not test ricobeck branch yet. I guess this is just another vote for SPM support for BluetoothKit. I won't submit my own pull request, just wait for progress on this one.

FWIW In my branch, the main issue was that as well as moving the source to a Sources folder, I needed to modify pretty much every .swift class to add @available(OSX 10.13, iOS 10.0, *) declarations, because BluetoothKit uses CoreBluetooth, which is not available in early versions of the SDKs and SPM requires that the code must compile with every SDK version. I seem to remember a request in Swift Package Manager itself for minimum SDK versions in the package definition which would save having these individual @available lines, but I don't know where that's sitting.

Oh, I also used a tag version of 0.5.0 - it's a bit more that a bug fix version update

flymg commented 4 years ago

Upvote on this one. Thank you very much!