ThenMorphingLabel
Fork from LTMorphingLabel
A morphing UILabel subclass written in Swift.
The .Scale
effect mimicked Apple's QuickType animation of iOS 8 of WWDC 2014. New morphing effects are available as Swift extensions.
enum ThenMorphingLabel.Effect: Int, Printable
.Scale - default
.Evaporate
.Fall
.Pixelate
.Sparkle
.Sparkle
is built on top of QuartzCore.CAEmitterLayer. There's also a SpriteKit powered version here.
.Burn
.Anvil
SwiftUI
public var body: some View {
VStack {
MorphingText(
"Awesome Morphing Text",
effect: .evaporate,
font: UIFont.systemFont(ofSize: 20),
textColor: .black,
textAlignment: .center
).frame(maxWidth: 200, maxHeight: 100)
...
Requirements
- iOS 11.0+
Installation
Swift Package Manager
- File > Swift Packages > Add Package Dependency
- Copy & paste
https://github.com/ghostcrying/ThenMorphingLabel
then follow the instruction
Carthage
- Add this line to your Cartfile:
github "ghostcrying/ThenMorphingLabel"
- Read the official instruction
CocoaPods
- Install the latest release of CocoaPods:
gem install cocoapods
- Add this line to your Podfile:
pod 'LTMorphingLabel'
- Install the pod:
pod install
Usage
- Change the class of a label from UILabel to LTMorphingLabel;
- Programmatically set a new String to its text property.
- To use interactively, call
.pause()
after changing.text
property, and useupdateProgress(progress: Float)
to update the progress interactively.