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

Can't get 1.4 & I am experience a lot of compiler warnings. #60

Open
hizzlehoff opened this issue Nov 18, 2021 · 3 comments
Open

Can't get 1.4 & I am experience a lot of compiler warnings. #60

hizzlehoff opened this issue Nov 18, 2021 · 3 comments

Comments

@hizzlehoff
Copy link

Thank you for this fantastic library.

I have two issues. I can use Cocoapods to get ~1.3.1 but not ~1.4,
and 1.3.1 throws a long list of warnings when compiling for iOS 15/Swift 5.

Will 1.4 be available via Cocoapods and will that resolve the warnings?

Cheers!

@fchen09
Copy link

fchen09 commented Jan 16, 2023

I got a bunch of warning like below
Initialization of 'UnsafeBufferPointer' results in a dangling buffer pointer
Any way to get rid of them?
Thanks!

@devinroth
Copy link
Member

I think I'm going to switch to SPM.

@fchen09
Copy link

fchen09 commented Jan 24, 2023

Here is how I fix the dangling pointer, and for ur reference

get {
var float = CFConvertFloat32HostToSwapped(Float32(self))
//let buffer = UnsafeBufferPointer(start: &float, count: 1)
let data = Swift.withUnsafeBytes(of: float) { Data($0) }
return data//Data(buffer: buffer)
}

init(_ data:Data){
var float = CFConvertFloat32HostToSwapped(Float())
//let buffer = UnsafeMutableBufferPointer(start: &float, count: 1)
//_ = data.copyBytes(to: buffer)
//value into Data
let data = Swift.withUnsafeBytes(of: float) { Data($0) }
//Data into value
_ = Swift.withUnsafeMutableBytes(of: &float, { data.copyBytes(to: $0)} )
self = Float(CFConvertFloat32SwappedToHost(float))
}

REF: https://www.appsloveworld.com/swift/100/6/warning-initialization-of-unsafebufferpointert-results-in-a-dangling-buffer

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

3 participants