'CGAffineTransformIdentity' is unavailable in Swift

前端 未结 1 1817
忘了有多久
忘了有多久 2021-02-06 21:06

Came across this error when trying to do adapt some animations into Swift3 syntax.

 UIView.animate(withDuration: duration, delay: 0.0, usingSpringWithDamping: 0         


        
相关标签:
1条回答
  • 2021-02-06 21:33

    Found this link which suggested that "The global constant was moved into a static property, and the Swift 3 migrator, as you've discovered, failed to correct for that. " and that you can simply change the code to :

     toView.transform = CGAffineTransform.identity
    

    EDIT

    or even simpler:

    toView.transform = .identity
    

    Hope this helps somebody.

    0 讨论(0)
提交回复
热议问题