jordanebelanger / SwiftyBluetooth

Closures based APIs for CoreBluetooth
MIT License
209 stars 66 forks source link

Compilation under Xcode 13 #48

Closed PFRene closed 2 years ago

PFRene commented 3 years ago

I'm getting loads of warnings when trying to compile this in the latest Xcode 13 RC (with Swift5) - mostly all errors are related to this sort of thing : "Argument type 'CBService?' does not conform to expected type 'CBUUIDConvertible'"

Any thoughts or suggestions? I'm having trouble working it out

EDIT: maybe helpful : If I open the same project into my saved copy of 12.5.1, it compiles the first try

jordanebelanger commented 3 years ago

Hello, I did a somewhat dirty fix (explicit unwrappings...) but I think it shouldn't cause any issue.

If you want, try with this branch https://github.com/jordanebelanger/SwiftyBluetooth/tree/swift5.5 until I finish merging the changes, need to make them backward compatible with Swift older than 5.5, that will take some time.

PFRene commented 2 years ago

Thanks! The 5.5 branch will help in the mean time, at least it compiles again ;)

Rolvar commented 2 years ago

@jordanebelanger are you planning to do a proper fix and release a new version to support XCode 13 builds? thanks in advance

jordanebelanger commented 2 years ago

@Rolvar I have a feeling that the current fix with the explicit unwrapping might be fine anyway and that it was just some sort of weird swift/objective-c evolution thing that led to the corebluetooth properties in question becoming optional.

Perhaps you or @PFRene can comment if you've been using the swift5.5 branch as to whether you've had any crashes using the new branch related to the new explicit unwrappings?

Rolvar commented 2 years ago

@jordanebelanger thanks for the quick reply, I've forked your code and you're right, seems to be something about how obj-c properties are being translated to optionals in swift, should be a better way, maybe use guard let instead? and make those throws an error that we can handle in production?

jordanebelanger commented 2 years ago

I don't wont to put unnecessary guard lets anywhere quite frankly I'd rather the program just crash if this is really some weird objective-c quirk.

Alright, I'll push a new cocoapods major release for this.

jordanebelanger commented 2 years ago

V3.0.0 is up and should fix xcode 13 related issues

Rolvar commented 2 years ago

Thanks @jordanebelanger 👏 🍻