[swift-dev] Is SE-0138 UnsafeRawBufferPointer included in Xcode 8 beta 3?

Jens Persson jens at bitcycle.com
Wed Oct 12 04:48:53 CDT 2016


I'm wondering about this too.

Xcode 8.1 beta 3 doesn't seem to include any of the pointer-related stuff
mentioned in the release notes section New in Xcode 8.1 beta 3 - Swift
Compiler.

/Jens


On Wed, Oct 12, 2016 at 2:13 AM, Norio Nomura via swift-dev <
swift-dev at swift.org> wrote:

> The release notes of Xcode 8.1 beta 3 said:
> > Two types have been added to the Swift standard library: UnsafeRawBufferPointer
> and UnsafeMutableRawBufferPointer.
>
> But I'm getting errors on building sample codes in release notes:
> ```
>
> *➜  **9:10:46 * DEVELOPER_DIR=/Applications/Xcode-beta.app swift
>
> Welcome to Apple Swift version 3.0.1 (swiftlang-800.0.56 clang-800.0.42).
> Type :help for assistance.
>
>   1> struct Header {
>
>   2.     var x: Int
>
>   3.     var y: Float
>
>   4. }
>
>   5.
>
>   6. var header = Header(x: 0, y: 0.0)
>
>   7. var byteBuffer = [UInt8]()
>
>   8. withUnsafeBytes(of: &header) { (bytes: UnsafeRawBufferPointer) in
>
>   9.     byteBuffer += bytes
>
>  10. }
>
>  11.
>
>  12. let intArray = [1, 2, 3]
>
>  13.
>
>  14. intArray.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
>
>  15.     byteBuffer += bytes
>
>  16. }
>
> error: repl.swift:8:1: error: use of unresolved identifier
> 'withUnsafeBytes'
>
> withUnsafeBytes(of: &header) { (bytes: UnsafeRawBufferPointer) in
>
> ^~~~~~~~~~~~~~~
>
>
> error: repl.swift:8:40: error: use of undeclared type
> 'UnsafeRawBufferPointer'
>
> withUnsafeBytes(of: &header) { (bytes: UnsafeRawBufferPointer) in
>
>                                        ^~~~~~~~~~~~~~~~~~~~~~
>
>
> error: repl.swift:14:36: error: use of undeclared type
> 'UnsafeRawBufferPointer'
>
> intArray.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
>
>                                    ^~~~~~~~~~~~~~~~~~~~~~
>
>
>
>   1>
>
> ```
>
> Am I missing something needed for using them?
> Thanks,
>
> Norio Nomura @norio_nomura
>
>
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20161012/8cb36c35/attachment.html>


More information about the swift-dev mailing list