Skip to content

Commit

Permalink
minor updates for latest OSs
Browse files Browse the repository at this point in the history
  • Loading branch information
lexrus committed Sep 20, 2020
1 parent c5471a4 commit 92a0ea9
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 59 deletions.
28 changes: 14 additions & 14 deletions LTMorphingLabel/LTEasing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import Foundation
public struct LTEasing {

public static func easeOutQuint(_ t: Float, _ b: Float, _ c: Float, _ d: Float = 1.0) -> Float {
return {
return c * (pow($0, 5) + 1.0) + b
return { (f: Float) in
return c * (pow(f, 5) + 1.0) + b
}(t / d - 1.0)
}

public static func easeInQuint(_ t: Float, _ b: Float, _ c: Float, _ d: Float = 1.0) -> Float {
let t1: Float = t / d
let t2: Float = c * t1 * t1 * t1 * t1 * t1 + b
return t2
return { (f: Float) in
c * pow(f, 5) + b
}(t / d)
}

public static func easeOutBack(_ t: Float, _ b: Float, _ c: Float, _ d: Float = 1.0) -> Float {
Expand All @@ -35,17 +35,17 @@ public struct LTEasing {
}

public static func easeOutBounce(_ t: Float, _ b: Float, _ c: Float, _ d: Float = 1.0) -> Float {
return {
if $0 < 1 / 2.75 {
return c * 7.5625 * $0 * $0 + b
} else if $0 < 2 / 2.75 {
let t = $0 - 1.5 / 2.75
return { (f: Float) in
if f < 1 / 2.75 {
return c * 7.5625 * f * f + b
} else if f < 2 / 2.75 {
let t = f - 1.5 / 2.75
return c * (7.5625 * t * t + 0.75) + b
} else if $0 < 2.5 / 2.75 {
let t = $0 - 2.25 / 2.75
} else if f < 2.5 / 2.75 {
let t = f - 2.25 / 2.75
return c * (7.5625 * t * t + 0.9375) + b
} else {
let t = $0 - 2.625 / 2.75
let t = f - 2.625 / 2.75
return c * (7.5625 * t * t + 0.984375) + b
}
}(t / d)
Expand Down
63 changes: 43 additions & 20 deletions LTMorphingLabelDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
archiveVersion = 1;
classes = {
};
objectVersion = 47;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
D701040D2516F5E500DB98F7 /* MorphingText.swift in Sources */ = {isa = PBXBuildFile; fileRef = D764373D2467A01A0037C36B /* MorphingText.swift */; platformFilter = maccatalyst; };
D720D06B1A5E91CB00747465 /* LTEasing.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AFEC911962511C0006FA88 /* LTEasing.swift */; };
D720D06C1A5E91CB00747465 /* LTStringDiffResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7633A2C195965A00009D084 /* LTStringDiffResult.swift */; };
D720D06D1A5E91CB00747465 /* LTMorphingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74AD98E19517430009A2ACD /* LTMorphingLabel.swift */; };
Expand Down Expand Up @@ -55,7 +56,6 @@
D74AD976195171E7009A2ACD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D74AD975195171E7009A2ACD /* Images.xcassets */; };
D74AD98D195173B5009A2ACD /* LTMorphingLabelDemo.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D74AD98C195173B5009A2ACD /* LTMorphingLabelDemo.storyboard */; };
D7633A2B195812020009D084 /* LTDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7633A2A195812020009D084 /* LTDemoViewController.swift */; };
D786856F2467A35800D4C46F /* MorphingText.swift in Sources */ = {isa = PBXBuildFile; fileRef = D764373D2467A01A0037C36B /* MorphingText.swift */; };
D7934DCB1A63AF1100AE04CE /* LTMorphingLabelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7934DCA1A63AF1100AE04CE /* LTMorphingLabelTests.swift */; };
D797F6F91D2E992200531960 /* LTCharacterDiffResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = D797F6F81D2E992200531960 /* LTCharacterDiffResult.swift */; };
D797F6FA1D2EA47A00531960 /* LTCharacterDiffResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = D797F6F81D2E992200531960 /* LTCharacterDiffResult.swift */; };
Expand Down Expand Up @@ -651,11 +651,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D701040D2516F5E500DB98F7 /* MorphingText.swift in Sources */,
D7EF4F081AB5612C00D46A0E /* LTCharacterLimbo.swift in Sources */,
D720D06B1A5E91CB00747465 /* LTEasing.swift in Sources */,
D720D06C1A5E91CB00747465 /* LTStringDiffResult.swift in Sources */,
D7EF4F041AB5608000D46A0E /* LTMorphingEffect.swift in Sources */,
D786856F2467A35800D4C46F /* MorphingText.swift in Sources */,
D720D06D1A5E91CB00747465 /* LTMorphingLabel.swift in Sources */,
D797F6F91D2E992200531960 /* LTCharacterDiffResult.swift in Sources */,
D720D06E1A5E91CB00747465 /* LTMorphingLabel+Evaporate.swift in Sources */,
Expand Down Expand Up @@ -716,8 +716,11 @@
);
INFOPLIST_FILE = "$(SRCROOT)/LTMorphingLabel/tvOS-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabel;
PRODUCT_NAME = LTMorphingLabel;
Expand All @@ -743,8 +746,11 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/LTMorphingLabel/tvOS-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabel;
PRODUCT_NAME = LTMorphingLabel;
Expand All @@ -766,8 +772,11 @@
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 5SKD83S59G;
INFOPLIST_FILE = LTMorphingLabelUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.LexTang.LTMorphingLabelUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -786,8 +795,11 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 5SKD83S59G;
INFOPLIST_FILE = LTMorphingLabelUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.LexTang.LTMorphingLabelUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -894,7 +906,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
METAL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
Expand All @@ -911,7 +924,10 @@
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = LTMorphingLabelDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabelDemo;
PRODUCT_NAME = Morphing;
PROVISIONING_PROFILE = "";
Expand All @@ -933,7 +949,10 @@
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = LTMorphingLabelDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabelDemo;
PRODUCT_NAME = Morphing;
PROVISIONING_PROFILE = "";
Expand All @@ -951,7 +970,6 @@
"$(inherited)",
);
INFOPLIST_FILE = LTMorphingLabelTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.LexTang.$(PRODUCT_NAME:rfc1034identifier)";
Expand All @@ -964,7 +982,6 @@
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = LTMorphingLabelTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.LexTang.$(PRODUCT_NAME:rfc1034identifier)";
Expand All @@ -989,8 +1006,11 @@
);
INFOPLIST_FILE = LTMorphingLabel/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabel;
PRODUCT_NAME = MorphingLabel;
Expand All @@ -1013,8 +1033,11 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = LTMorphingLabel/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = sh.lex.LTMorphingLabel;
PRODUCT_NAME = MorphingLabel;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D7D4B01E1A5E87D50087F83D"
BuildableName = "LTMorphingLabel.framework"
BuildableName = "MorphingLabel.framework"
BlueprintName = "LTMorphingLabel"
ReferencedContainer = "container:LTMorphingLabelDemo.xcodeproj">
</BuildableReference>
Expand All @@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D7D4B01E1A5E87D50087F83D"
BuildableName = "LTMorphingLabel.framework"
BuildableName = "MorphingLabel.framework"
BlueprintName = "LTMorphingLabel"
ReferencedContainer = "container:LTMorphingLabelDemo.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -73,7 +73,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D7D4B01E1A5E87D50087F83D"
BuildableName = "LTMorphingLabel.framework"
BuildableName = "MorphingLabel.framework"
BlueprintName = "LTMorphingLabel"
ReferencedContainer = "container:LTMorphingLabelDemo.xcodeproj">
</BuildableReference>
Expand All @@ -89,7 +89,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D7D4B01E1A5E87D50087F83D"
BuildableName = "LTMorphingLabel.framework"
BuildableName = "MorphingLabel.framework"
BlueprintName = "LTMorphingLabel"
ReferencedContainer = "container:LTMorphingLabelDemo.xcodeproj">
</BuildableReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D73DFD001F4DB5CC00F84122"
BuildableName = "LTMorphingLabel_tvOS.framework"
BuildableName = "LTMorphingLabel.framework"
BlueprintName = "LTMorphingLabel_tvOS"
ReferencedContainer = "container:LTMorphingLabelDemo.xcodeproj">
</BuildableReference>
Expand All @@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -46,13 +44,11 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D73DFD001F4DB5CC00F84122"
BuildableName = "LTMorphingLabel_tvOS.framework"
BuildableName = "LTMorphingLabel.framework"
BlueprintName = "LTMorphingLabel_tvOS"
ReferencedContainer = "container:LTMorphingLabelDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand All @@ -64,7 +60,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D73DFD001F4DB5CC00F84122"
BuildableName = "LTMorphingLabel_tvOS.framework"
BuildableName = "LTMorphingLabel.framework"
BlueprintName = "LTMorphingLabel_tvOS"
ReferencedContainer = "container:LTMorphingLabelDemo.xcodeproj">
</BuildableReference>
Expand Down
11 changes: 9 additions & 2 deletions LTMorphingLabelDemo/LTDemoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ class LTDemoViewController : UIViewController, LTMorphingLabelDelegate {
i = i >= textArray.count - 1 ? 0 : i + 1
return textArray[i]
}

@IBOutlet weak var effectSegmentControl: UISegmentedControl!
@IBOutlet weak var themeSegmentControl: UISegmentedControl!
@IBOutlet fileprivate var label: LTMorphingLabel!

override func viewDidLoad() {
super.viewDidLoad()

label.delegate = self

[effectSegmentControl, themeSegmentControl].forEach {
$0?.setTitleTextAttributes([.foregroundColor : UIColor.white], for: .normal)
$0?.setTitleTextAttributes([.foregroundColor : UIColor.white], for: .selected)
}
}

@IBOutlet fileprivate var label: LTMorphingLabel!

@IBAction func changeText(_ sender: AnyObject) {
label.text = text
Expand Down
Loading

0 comments on commit 92a0ea9

Please sign in to comment.