https://github.com/truffls/view-transformers-ios
ViewTransformers lets you pass multiple view transformations as an array to UIView.
https://github.com/truffls/view-transformers-ios
Last synced: about 2 months ago
JSON representation
ViewTransformers lets you pass multiple view transformations as an array to UIView.
- Host: GitHub
- URL: https://github.com/truffls/view-transformers-ios
- Owner: truffls
- License: mit
- Created: 2017-12-13T17:44:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-25T10:24:43.000Z (almost 7 years ago)
- Last Synced: 2024-04-24T13:36:10.765Z (about 1 year ago)
- Language: Swift
- Size: 438 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README



ViewTransformers lets you pass multiple view transformations as an array to UIView.
### Install via Cocoapods
Add following to your `Podfile`:
```ruby
use_frameworks!
pod 'ViewTransformers'
```### How to use
You can easily pass multiple view transformations to a UIView by using the `transforms` property on UIView.
```swift
view.transforms = [
CGAffineTransform(scaleX: 0.5, y: 0.5),
CGAffineTransform(rotationAngle: -1.42),
CGAffineTransform(translationX: 100, y: -145)
]
```Reading the transforms property only returns the merged transformations as one in a one-item-array.
### Example

Used code for the example:
```swift
func playAnimation() {
UIView.animate(withDuration: 1.0, delay: 1.0, options: .curveLinear, animations: {
self.myView.transforms = [
CGAffineTransform(scaleX: 0.5, y: 0.5),
CGAffineTransform(rotationAngle: -1.42),
CGAffineTransform(translationX: 100, y: -145)
]
}, completion: { _ in
UIView.animate(withDuration: 1.0, delay: 1.0, options: .curveLinear, animations: {
self.myView.transforms = nil
}, completion: { _ in
self.playAnimation()
})
})
}
```### Contribution
Issues and pull requests are welcome!