Comments (7)
It is simply a converter from single value of type UIViewAnimationCurve
to single value of type UIViewAnimationOptions
. You could do, for example:
let animationCurve = UIViewAnimationCurve.easeInOut
let animationOption = viewAnimationOptionForCurve(curve: animationCurve)
let options = [.beginFromCurrentState, option]
from typist.
Hey, thanks for opening issue! Typist is designed to be used with UIViewPropertyAnimator
(see below) rather older UIView
animation blocks.
UIViewPropertyAnimator(duration: TimeInterval, curve: UIViewAnimationCurve, animations: (() -> Void)? = nil)
However, I'll consider adding few other representations for curves for pre-iOS 10 compatibility reasons.
from typist.
I used this which seems right to me https://gist.github.com/miguellara/9e498715ee93540d79e9. I would suggest that it should be included to Typist
from typist.
@nezhyborets does this work for multiple values like [.beginFromCurrentState, .curveEaseInOut]
?
from typist.
Updated for Swift3
func animationOptions(fromAnimationCurve curve: UIViewAnimationCurve) -> UIViewAnimationOptions {
switch (curve) {
case .easeInOut: return UIViewAnimationOptions.curveEaseInOut
case .easeIn: return UIViewAnimationOptions.curveEaseIn
case .easeOut: return UIViewAnimationOptions.curveEaseOut
case .linear: return UIViewAnimationOptions.curveLinear
}
}
from typist.
@totocaster I switched to this code
func keyboardWillShow(options: Typist.KeyboardOptions) {
self.loginButtonConstraint.constant = -options.endFrame.height-Style.Size.Padding
UIViewPropertyAnimator(duration: options.animationDuration, curve: options.animationCurve) {
self.view.layoutIfNeeded()
}.startAnimation()
}
but now getting this error
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unknown/Unsupported UIViewAnimationCurve type 7'
from typist.
@kgn I believe you have to keep reference to instance of UIViewPropertyAnimator
while animation happens. If you don't wish to do so use UIViewPropertyAnimator .runningPropertyAnimator(withDuration:delay:options:animations:completion:)
. It also start animation automatically.
See UIViewPropertyAnimator docs here.
from typist.
Related Issues (16)
- Installation Section HOT 1
- Make it possible to use typist in multiple View controllers at the same time HOT 4
- Add toolbar support HOT 2
- Build failure for Pod version 1.2.0 HOT 1
- CocoaPods HOT 1
- Add support for Swift Package Manager HOT 1
- Swift 4.2 Release HOT 3
- ios 12 changes HOT 2
- UIViewAnimationCurve(rawValue: 7) Error HOT 1
- Add support for Swift Package Manager in Xcode 11 HOT 2
- Please fix SMP support HOT 2
- SPM Doesn't work, please add 1.4.3 release HOT 4
- Any plans for Carthage support? HOT 2
- iOS10 Supported only? HOT 5
- The singleton pattern is encouraged, but doesn't support multiple callbacks HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typist.