Re: [swift-users] Data withUnsafeBytes

2016-09-04 Thread Chris McIntyre via swift-users
That makes sense. I think I've gotten so used to the type system magically figuring out what I want, combined with the error message pointing to the return type that this just went right over my head. -- Chris McIntyre > On Sep 4, 2016, at 3:59 PM, Ole Begemann via swift-users > wrote: > >

Re: [swift-users] Data withUnsafeBytes

2016-09-04 Thread Ole Begemann via swift-users
The compiler has no way of inferring the type of the generic ContentType parameter because you're not using that parameter anywhere in the body of the closure that could give the compiler a hint. So you have to provide the type manually by explicitly annotating the type of the closure's paramet

[swift-users] Data withUnsafeBytes

2016-09-03 Thread Chris McIntyre via swift-users
Hi guys, I’m either missing a subtlety in regards to closures or I found a bug with the type inference system in Xcode 8 Beta 6. Thought I’d run it by you. I’m trying to use Data’s method withUnsafeBytes(_:). It’s declared as: func withUnsafeBytes(_ body: (UnsafePointer) throws -> ResultType