Skip to content

ktiays/GlyphixTextFx

Repository files navigation

GlyphixTextFx

A label component that provides content transition animations like SwiftUI's numericText.

Note

The library originally named NumericTransitionLabel is now renamed to GlyphixTextFx.

Features

  • Per-character smooth animations when text changes
  • Customizable transition direction (upward or downward)
  • Multiple text alignment options (left, center, right)
  • Multi-line text support with configurable line break modes
  • Optional blur effects for enhanced visual transitions
  • Smooth rendering option for improved text appearance
  • Works with both UIKit/AppKit and SwiftUI

Preview

Replay.mp4

You can find the example project in the Example directory.

Supported Platforms

  • iOS 13.0+
  • macOS 11.0+

Installation

Swift Package Manager

Add GlyphixTextFx to your Swift package dependencies:

dependencies: [
    .package(url: "https://github.com/ktiays/GlyphixTextFx.git", from: "2.0.0")
]

Usage

UIKit/AppKit

import GlyphixTextFx
import UIKit

let label = GlyphixTextLabel()
label.font = .systemFont(ofSize: 36, weight: .bold)
label.textColor = .systemBlue
label.countsDown = true
label.text = "1234567890"

SwiftUI

import SwiftUI
import GlyphixTextFx

struct ContentView: View {
    var body: some View {
        GlyphixText("1234567890")
            .glyphixLabelFont(.systemFont(ofSize: 36, weight: .bold))
            .glyphixLabelColor(.systemBlue)
    }
}

See the component documentation comments for other related usage details.

Performance Considerations

Important

The blur effect can significantly impact performance, especially with longer text. It's recommended to disable blur effects for better performance when displaying large amounts of text:

// Disable blur for better performance with long text.
label.isBlurEffectEnabled = false

License

GlyphixTextFx is available under the MIT license. See the LICENSE file for more info.