Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGAffineTransformConCat/ CGAffineTransformMakeScale in Swift 3

I'm trying to update a part of a function for swift 3:

  let newLabelOffset = CGFloat(direction.rawValue) * originalFrame.size.height/2

    newLabel.transform = CGAffineTransformConCat(
      CGAffineTransformMakeScale(1,0)
      CGAffineTransformMakeTranslation(0,newLabelOffset)
    )

I've heard that the new way of using CGAffineTransformConCat is concatenating(_:) but not entirely sure how to set it up based on the 2 above transforms.

like image 405
SwiftyJD Avatar asked Dec 11 '22 11:12

SwiftyJD


1 Answers

Init transforms,

let trans1 = CGAffineTransform(scaleX: 0, y: 0)
let trans2 = CGAffineTransform(translationX: 0,y: 1)

Concatenate,

trans1.concatenating(trans2)
like image 196
Jože Ws Avatar answered May 16 '23 07:05

Jože Ws