ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - lexrus/LTMorphingLabel: [EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift.
[EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift. - lexrus/LTMorphingLabel
Visit Site

GitHub - lexrus/LTMorphingLabel: [EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift.

GitHub - lexrus/LTMorphingLabel: [EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift.

LTMorphingLabel

Travis Language CocoaPods Carthage compatible Accio supported License

A morphing UILabel subclass written in Swift, originally designed to mimic Apple's QuickType animation in iOS 8 at WWDC 2014.

Table of Contents

Available Effects

.scale (default)

.evaporate

.fall

.pixelate

.sparkle

.sparkle is built on top of QuartzCore.CAEmitterLayer. There is also a SpriteKit-powered version here.

.burn

.anvil

Usage

UIKit

Since LTMorphingLabel is a drop-in replacement, you can use it like any UILabel by setting its text property, yielding the default effect (.scale):

var exampleLabel = LTMorphingLabel()
exampleLabel.text = "This is a test"

UIKitExample1

Alternatively, it can be used interactively:

var exampleLabel = LTMorphingLabel()
exampleLabel.text = "This is a test"
exampleLabel.pause()

// Call .updateProgress(progress: Float) for interactive animation
// Note: In this case, animation will stop at 45% and will not complete
//       unless called later with 100 as the `progress` float value.
exampleLabel.updateProgress(progress: 45.0)

The effect can be changed by setting the morphingEffect property:

var exampleLabel = LTMorphingLabel()
exampleLabel.text = "This is a test"
exampleLabel.morphingEffect = .burn

UIKitExample2

SwiftUI

To use LTMorphingLabel in SwiftUI, simply declare it and set its text, effect, font, and textColor properties:

public var body: some View {
    VStack {
        MorphingText(
            "This is a test",
            font: UIFont.systemFont(ofSize: 20),
            textColor: .black,
            textAlignment: .center
        )
        .frame(maxWidth: 200, maxHeight: 100)
    }
}

Similar to its use in UIKit, you can also specify the morphing effect manually (if you do not want to use the default .scale effect):

public var body: some View {
    VStack {
        MorphingText(
            "This is a test",
            effect: .burn, // Specify an alternative morphing effect with this line
            font: UIFont.systemFont(ofSize: 20),
            textColor: .black,
            textAlignment: .center
        )
        .frame(maxWidth: 200, maxHeight: 100)
    }
}

LTMorphingLabelSwiftUI

Requirements

  • Xcode 12+
  • iOS 9.0+ (note that SwiftUI requires iOS 13+)

Installation

Swift Package Manager

Simply add this library to your package manifest or follow instructions on adding a package dependency using Xcode here.

.package(
    url: "https://github.com/lexrus/LTMorphingLabel.git",
    .branch("master")
)

CocoaPods

Add pod 'LTMorphingLabel' to your Podfile or follow instructions to add dependencies here.

Carthage

Add github "lexrus/LTMorphingLabel" to your Cartfile or follow instructions on adding frameworks here.

XCFramework

A pre-compiled xcframework file is available on the Releases page.

Accio

  1. Add this library to your package manifest (see Swift Package Manager)

  2. Update your target dependencies to include LTMorphingLabel:

.target(
    name: "App",
    dependencies: [
        "LTMorphingLabel",
    ]
),
  1. Run accio update.

Unit Testing

Clone the repo by running git clone https://github.com/lexrus/LTMorphingLabel.git, then open the project with Xcode and press Cmd + U (or, in the menu bar, click Product > Build for > Testing).

Apps Using LTMorphingLabel

Third-Party Ports

Android

The Android port of this library is available here.

React Native

The React Native port of this library is available here.

License

This code is distributed under the terms and conditions of the MIT license.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory