From 23edee728bb916cf87b848a4c09b50c77f955a71 Mon Sep 17 00:00:00 2001 From: Ela Date: Tue, 10 Nov 2020 11:39:29 +0530 Subject: [PATCH 1/3] TASK: Compiler error fixes --- CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift | 4 ++-- CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift | 2 +- CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift | 4 ++-- CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift index aed6fe3..627f338 100644 --- a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift +++ b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift @@ -50,8 +50,8 @@ extension LTMorphingLabel { height: maskedHeight ) String(charLimbo.char).draw(in: rect, withAttributes: [ - .font: self.font, - .foregroundColor: self.textColor + .font: self.font ?? UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body), + .foregroundColor: self.textColor ?? .black ]) let newImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() diff --git a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift index 4f2ff46..994640a 100644 --- a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift +++ b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift @@ -88,7 +88,7 @@ extension LTMorphingLabel { height: charLimbo.rect.size.height ) String(charLimbo.char).draw(in: rect, withAttributes: [ - .font: self.font, + .font: self.font ?? UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body), .foregroundColor: self.textColor.withAlphaComponent(fadeOutAlpha) ]) let newImage = UIGraphicsGetImageFromCurrentImageContext() diff --git a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift index b297470..a119fa8 100644 --- a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift +++ b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift @@ -50,8 +50,8 @@ extension LTMorphingLabel { height: maskedHeight ) String(charLimbo.char).draw(in: rect, withAttributes: [ - .font: self.font, - .foregroundColor: self.textColor + .font: self.font ?? UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body), + .foregroundColor: self.textColor ?? .black ]) guard let newImage = UIGraphicsGetImageFromCurrentImageContext() else { return (UIImage(), CGRect.zero) diff --git a/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift b/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift index 6b100ac..3b7602c 100644 --- a/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift +++ b/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift @@ -31,7 +31,7 @@ public typealias LTStringDiffResult = ([LTCharacterDiffResult], skipDrawingResul public extension String { - public func diffWith(_ anotherString: String?) -> LTStringDiffResult { + func diffWith(_ anotherString: String?) -> LTStringDiffResult { guard let anotherString = anotherString else { let diffResults: [LTCharacterDiffResult] = From e86bf1088316b4aee34ffb57681d3f3a802513cd Mon Sep 17 00:00:00 2001 From: Ela Date: Tue, 10 Nov 2020 11:40:50 +0530 Subject: [PATCH 2/3] TASK: Fix expression to remove type-check compiler error --- CountdownLabel/LTMorphingLabel/LTEasing.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CountdownLabel/LTMorphingLabel/LTEasing.swift b/CountdownLabel/LTMorphingLabel/LTEasing.swift index 090d37d..d265652 100644 --- a/CountdownLabel/LTMorphingLabel/LTEasing.swift +++ b/CountdownLabel/LTMorphingLabel/LTEasing.swift @@ -24,7 +24,7 @@ public struct LTEasing { public static func easeInQuint(_ t: Float, _ b: Float, _ c: Float, _ d: Float = 1.0) -> Float { return { - return c * $0 * $0 * $0 * $0 * $0 + b + return c * ($0 * $0 * $0 * $0 * $0) + b }(t / d) } From a525d95b40cf8382ae8fd94994a48a18c915b961 Mon Sep 17 00:00:00 2001 From: Ela Date: Tue, 10 Nov 2020 12:53:46 +0530 Subject: [PATCH 3/3] Revert "TASK: Compiler error fixes" This reverts commit 23edee728bb916cf87b848a4c09b50c77f955a71. --- CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift | 4 ++-- CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift | 2 +- CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift | 4 ++-- CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift index 627f338..aed6fe3 100644 --- a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift +++ b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Burn.swift @@ -50,8 +50,8 @@ extension LTMorphingLabel { height: maskedHeight ) String(charLimbo.char).draw(in: rect, withAttributes: [ - .font: self.font ?? UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body), - .foregroundColor: self.textColor ?? .black + .font: self.font, + .foregroundColor: self.textColor ]) let newImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() diff --git a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift index 994640a..4f2ff46 100644 --- a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift +++ b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Pixelate.swift @@ -88,7 +88,7 @@ extension LTMorphingLabel { height: charLimbo.rect.size.height ) String(charLimbo.char).draw(in: rect, withAttributes: [ - .font: self.font ?? UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body), + .font: self.font, .foregroundColor: self.textColor.withAlphaComponent(fadeOutAlpha) ]) let newImage = UIGraphicsGetImageFromCurrentImageContext() diff --git a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift index a119fa8..b297470 100644 --- a/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift +++ b/CountdownLabel/LTMorphingLabel/LTMorphingLabel+Sparkle.swift @@ -50,8 +50,8 @@ extension LTMorphingLabel { height: maskedHeight ) String(charLimbo.char).draw(in: rect, withAttributes: [ - .font: self.font ?? UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body), - .foregroundColor: self.textColor ?? .black + .font: self.font, + .foregroundColor: self.textColor ]) guard let newImage = UIGraphicsGetImageFromCurrentImageContext() else { return (UIImage(), CGRect.zero) diff --git a/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift b/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift index 3b7602c..6b100ac 100644 --- a/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift +++ b/CountdownLabel/LTMorphingLabel/LTStringDiffResult.swift @@ -31,7 +31,7 @@ public typealias LTStringDiffResult = ([LTCharacterDiffResult], skipDrawingResul public extension String { - func diffWith(_ anotherString: String?) -> LTStringDiffResult { + public func diffWith(_ anotherString: String?) -> LTStringDiffResult { guard let anotherString = anotherString else { let diffResults: [LTCharacterDiffResult] =