Search code examples
swiftswift3core-graphics

'CGAffineTransformMake' is unavailable in swift 3


This code doesn't compile in swift 3:

let flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, newSize.height)
context.concatenate(flipVertical)

How would I convert this over?


Solution

  • In Swift 3, these free-standing functions have been replaced with the init syntax:

    let flipVertical = CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: newSize.height)