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,
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@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,
This is an error in the release notes. You’re not missing anything and Swift in Xcode 8.1 beta 2 is the same as Xcode 8.1 beta 3. Sorry for the confusion and we’ll get the release notes fixed up.
Thanks,
Ewa
···
On Oct 12, 2016, at 2:48 AM, Jens Persson via swift-dev <swift-dev@swift.org> wrote:
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@swift.org <mailto:swift-dev@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,
This is an error in the release notes. You’re not missing anything and
Swift in Xcode 8.1 beta 2 is the same as Xcode 8.1 beta 3. Sorry for the
confusion and we’ll get the release notes fixed up.
Thanks,
Ewa
On Oct 12, 2016, at 2:48 AM, Jens Persson via swift-dev < > swift-dev@swift.org> wrote:
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@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,