stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.67k stars 1.56k forks source link

Binary data - convert to Swift 5 #924

Closed SamSandq closed 3 years ago

SamSandq commented 5 years ago

I am using (a per your documentation some time ago):

extension Data {
    public static var declaredDatatype: String {
        return Blob.declaredDatatype
    }

    public static func fromDatatypeValue(_ dataValue: Blob) -> Data {
        return Data(dataValue.bytes)
    }

    public var datatypeValue: Blob {
        return withUnsafeBytes( { (pointer: UnsafePointer<UInt8>) -> Blob in Blob(bytes: pointer, length: count) } )
    }

}

which gives the following in latest Xcode and Macos: 'withUnsafeBytes' is deprecated: use withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R instead

which I have tried to do with no success. Could you help me here?

nathanfallet commented 3 years ago

Should be fixed in 0.13.0. If not, please reopen this issue.