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

Deprecated ''withUnsafeMutableBytes' and 'withUnsafeBytes' #14

Open
FancyRobot opened this issue Dec 17, 2019 · 1 comment
Open

Deprecated ''withUnsafeMutableBytes' and 'withUnsafeBytes' #14

FancyRobot opened this issue Dec 17, 2019 · 1 comment

Comments

@FancyRobot
Copy link

Hi,
Thank you for creating this framework, it has been exactly what I needed for my project.
Since the shift to swift 5 there are two warnings due to deprecation:

''withUnsafeMutableBytes' is deprecated: use withUnsafeMutableBytes<R>(_: (UnsafeMutableRawBufferPointer) throws -> R) rethrows -> R instead

'withUnsafeBytes' is deprecated: use withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R instead

I have not focused on fixing this yet but I thought of mentioning it already.

@NeilsUltimateLab
Copy link

For those who are looking for the fix.

_ = data.withUnsafeBytes { pointer in 
    guard let bytes = pointer.baseAddress?.assumingMemoryBound(to: Unit8.self) else { return }
    //... use bytes here
} 

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

No branches or pull requests

2 participants