var hasher = Hasher()

hasher.combine(patternString)

var hashValue = hasher.finalize()

var data = Data()

 

[문제 코드]

* Initialization of 'UnsafeBufferPointer' results in a dangling buffer pointer 경고 

data.append(UnsafeBufferPointer(start: &hashValue, count: 1))

 

[수정 소스]

withUnsafePointer(to: &hashValue) {

       data.append(UnsafeBufferPointer(start: $0, count: 1))

}

+ Recent posts