Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Xcode 13 Builds but retaining Xcode 12 and older compatibility #433

Merged

Conversation

dinesharjani
Copy link
Contributor

In Swift 5.5 Apple changed CBCharacteristic's CBService from being unowned to weak, which breaks the existing code under Xcode 13 whilst at the same time, making said fixes break Xcode 12 due to the change being implemented via Swift versioning. I think this fix should work for both Xcode 13 users downgrading their installed Swift to 5.4 or older as well as the opposite, Xcode 12 users who upgrade their internal Swift version to 5.5 and newer.

@CLAassistant
Copy link

CLAassistant commented Jun 22, 2021

CLA assistant check
All committers have signed the CLA.

In Swift 5.5 Apple changed CBCharacteristic's CBService from being unowned to weak, which breaks the existing code under Xcode 13 whilst at the same time, making said fixes break Xcode 12 due to the change being implemented via Swift versioning. I think this fix should work for both Xcode 13 users downgrading their installed Swift to 5.4 or older as well as the opposite, Xcode 12 users who upgrade their internal Swift version to 5.5 and newer.
Copy link
Member

@philips77 philips77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I don't like how you implemented few changes. Let's begin.

Copy link
Member

@philips77 philips77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mark required changes before :)

@@ -247,7 +251,11 @@ internal struct PacketReceiptNotification {
self.resetSent = false

// Get the peripheral object.
#if swift(>=5.5)
guard let peripheral = characteristic.service?.peripheral else { return }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it just return without logging or execution of other logic in this method? Shouldn't it invoke/clear callbacks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I'll look into it today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this PR and perhaps prepare another one with following changes.

@philips77 philips77 changed the base branch from master to develop June 23, 2021 14:06
@philips77 philips77 merged commit 89e8dca into NordicSemiconductor:develop Jun 24, 2021
@dinesharjani dinesharjani deleted the xcode-13-compat-fix branch June 24, 2021 14:27
This was referenced Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants