Bouke / HAP

Swift implementation of the Homekit Accessory Protocol
https://boukehaarsma.nl/HAP/
MIT License
364 stars 50 forks source link

deprecated warnings when compiling #122

Closed ctmanley closed 3 years ago

ctmanley commented 3 years ago

I complied the HAP project on a Raspberry Pi. The Pi had a fresh install of the OS.

I installed all the dependencies described in the Getting Started section of the documentation.

When I compiled the project, I got a number of warnings that some things were deprecated. In particular there were a lot of warnings about the init for the Data struct. Here is one example.

PairSetupController.swift:68:22: warning: 'init(bytes:)' is deprecated: replaced by 'init(_:)' (.state, Data(bytes: [PairSetupStep.startResponse.rawValue])),

PairSetupController.swift:68:22: note: use 'init(_:)' instead Data(bytes: [PairSetupStep.startResponse.rawValue])),

Here are some other examples.

Hashable.swift:15:16: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'BigUInt' to 'Hashable' by implementing 'hash(into:)' instead public var hashValue: Int {

ChaCha20Poly1305.swift:23:21: warning: 'withUnsafeBytes' is deprecated: use withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R instead message.withUnsafeBytes { m in

I haven't gone too much further yet so I don't know how this affects the software behavior. I just thought I should point this out.

I was able to scan the QR code to pair with my phone and the Pi shows up as a bridge.

Bouke commented 3 years ago

Deprecation of an API means that they will be removed from a future Swift release, not that they are no longer functioning. So in this case they can be ignored, as their use might be needed for backward compatibility, depending on our minimal targeted version.

ctmanley commented 3 years ago

Thanks.