Начал сбой с EXC_BAD_ACCESS при создании приложения после нового обновления Xcode 11.4. Сбои только при сборке с конфигурацией выпуска, без отладки конфигурации.
Разрывы на: let img = ctx.makeImage()!
func image() -> CGImage {
if let image = generatedImage {
return image
}
let w = Int(size.width * scale)
let h = Int(size.height * scale)
let bitsPerComponent: Int = MemoryLayout<UInt8>.size * 8
let bytesPerPixel: Int = bitsPerComponent * 4 / 8
let bytesPerRow = w * bytesPerPixel
var data = [ARGB]()
for y in 0..<h {
for x in 0..<w {
let c = pixelDataForGradient(at: CGPoint(x: x, y: y),
size: CGSize(width: w, height: h),
colors: colors,
locations: locations,
startPoint: startPoint,
endPoint: endPoint)
data.append(c)
}
}
let colorSpace = CGColorSpaceCreateDeviceRGB()
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedFirst.rawValue)
let ctx = CGContext(data: &data, width: w, height: h, bitsPerComponent: bitsPerComponent, bytesPerRow: bytesPerRow, space: colorSpace, bitmapInfo: bitmapInfo.rawValue)!
ctx.interpolationQuality = .none
ctx.setShouldAntialias(false)
let img = ctx.makeImage()!
generatedImage = img
return img
}