• Stars
    star
    7,983
  • Rank 4,421 (Top 0.09 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[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)

LTMorphingLabel

LTMorphingLabel-Evaporate

LTMorphingLabel-Fall

LTMorphingLabel-Pixelate

LTMorphingLabel-Sparkle

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

LTMorphingLabel-Burn

LTMorphingLabel-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

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")
)

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

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

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

  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 Repositories

1

VPNOn

Turn On your VPN like a hero.
Swift
4,470
star
2

fontdiao

[已废弃]中文图标字体,可用于 Web 或 iOS,同时提供了国内各种常用网站、应用的徽标 SVG 源文件。
CSS
617
star
3

ios-makefile

[DEPRECATED] The universal makefile for my iOS projects distributes IPAs in seconds
Shell
577
star
4

ios-dev-playbook

不会运维的 iOS 开发不是好设计师。这个 Ansible Playbook 能快速配置 iOS 开发需要的服务,安装如 Gogs、GitLab、Jenkins、Ghost、Ajenti 等常用服务。
Ruby
555
star
5

LTBouncyPlaceholder

A learning-by-doing UITextField extension written in Swift
Swift
490
star
6

LTJelloSwitch

A rapid prototype of UISwitch built with Swift and PaintCode.
Swift
365
star
7

LeetCode.swift

Once upon a time there was a noob of algorithms, and he knew a little about Swift.
Swift
357
star
8

LTFinderButtons

My Finder buttons collection for macOS.
Rich Text Format
305
star
9

PhoneticContacts

为你的联系人加上拼音属性,这样即使你的 iPhone 设置成英文,也能有按拼音分段的功能。暂时还没有改成用 Contacts framework,Xcode 10 无法运行哦
Swift
294
star
10

RegExPlus

A nifty RegEx test tool built with SwiftUI
Swift
203
star
11

QLSwift

A Quick Look plugin for Swift files
Objective-C
177
star
12

Huahui

。.゚✧:✿花༙྇灰༙྇✿:✧゚.。 - 灰化肥会发黑,花会化灰。又名『中国程序员常读错的英文单词的 App』
Swift
152
star
13

LTBlacklist

[DEPRECATED] The missing Blacklist app for your iOS 5/6 with private APIs. No Jailbreak Required!
Objective-C
147
star
14

SwiftyMenu

The missing Finder menu for your daily ease
Swift
128
star
15

MMDB-Swift

A tiny wrapper for libmaxminddb which allows you to lookup Geo data by IP address.
C
120
star
16

APN

[已废弃]适合 iOS 7 的 APN 设置工具,又一个没过审核的周末项目
Objective-C
116
star
17

LTUpdate

[DEPRECATED] LeT'sUpdate to the new version available in the AppStore! A GCD powered, ARC/MRC compatible class with block interfaces.
Objective-C
75
star
18

LexClockWidget

Swift
73
star
19

KissDefault

[EXPERIMANTAL] 💋Keep It(UserDefaults propertyWrapper) Simple and Stupid
Swift
46
star
20

.files

Dotfiles for my Mac
Shell
34
star
21

HighlightJSON

A tiny Safari Web Extension for presenting highlighted JSON files
Swift
33
star
22

LTTabBar

[DEPRECATED] A clumsy mimic of the Chrome-style tab bar for iOS.
Objective-C
32
star
23

LexNightmare

A boring game built with SpriteKit and Swift.
Swift
23
star
24

HNAPI

Tiny HackerNews API wrapper.
Swift
21
star
25

iDevBox

Yet another learning-by-doing XcodeKit project
Swift
18
star
26

LTDribbbleAPI

Yet another Dribbble API client for iOS 6.0+ and Mac OS X 10.8+ based on AFNetworking 2.0.
Objective-C
12
star
27

XcodeAutomator

Automator services for Xcode
8
star
28

PixelPusher

Compare your app with the original design pixel-by-pixel.
Swift
7
star
29

ansible-role-docker

An Ansible role to install Docker in Debian or Ubuntu
6
star
30

GCD

GCD = Ghost + Caddy + Dropbox
Shell
6
star
31

ios_notebook

3
star
32

XcodeTemplates

My personal Xcode templates
3
star
33

lexrus

2
star
34

LibWebpXCDemo

Swift
1
star
35

lexrus.github.io

My personal Hugo website: https://lex.sh
SCSS
1
star