IはSWIFであるthis link からのコードを使用する2array.withUnsafeMutableBufferPointerをswift 2からswift 3に移行するにはどうすればよいですか?
public protocol SGLImageType {
typealias Element
var width:Int {get}
var height:Int {get}
var channels:Int {get}
var rowsize:Int {get}
func withUnsafeMutableBufferPointer(
@noescape body: (UnsafeMutableBufferPointer<Element>) throws -> Void
) rethrows
}
プロトコル上に実装クラス:
:3迅速に'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type
final public class SGLImageRGBA8 : SGLImageType { ... public func withUnsafeMutableBufferPointer(@noescape body: (UnsafeMutableBufferPointer<UInt8>) throws -> Void) rethrows {
try array.withUnsafeMutableBufferPointer(){
// This is unsafe reinterpret cast. Be careful here.
let st = UnsafeMutablePointer<UInt8>($0.baseAddress)
try body(UnsafeMutableBufferPointer<UInt8>(start: st, count: $0.count*channels))
}
}
は、ラインlet st = UnsafeMutablePointer<UInt8>($0.baseAddress)
このエラーをスロー
このエラーを解決するにはどうすればよいですか?
[Swift 3 UnsafePointer($ 0)はXcode 8 beta 6でコンパイルされなくなる可能性があります](http://stackoverflow.com/questions/39046377/swift-3-unsafepointer0-no-longer-compile-in-xcode) -8-beta-6) – kennytm
@kennytmその重複はありません。 – xaled