<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div style="direction: inherit;">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. </div><div style="direction: inherit;"><br></div><div style="direction: inherit;">--</div><div style="direction: inherit;">Chris McIntyre</div></div><div><br>On Sep 4, 2016, at 3:59 PM, Ole Begemann via swift-users <<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><span>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 parameter.</span><br><span></span><br><span>For example, if you want to treat `items` as a series of `UInt8` values:</span><br><span></span><br><span> let tryThis = items.withUnsafeBytes {</span><br><span> (bytes: UnsafePointer<UInt8>) -> Int in</span><br><span> return 1</span><br><span> }</span><br><span></span><br><span>I agree the compiler diagnostic should probably be better, though.</span><br><span></span><br><span>Ole</span><br><span></span><br><span>_______________________________________________</span><br><span>swift-users mailing list</span><br><span><a href="mailto:swift-users@swift.org">swift-users@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-users">https://lists.swift.org/mailman/listinfo/swift-users</a></span><br></div></blockquote></body></html>