Skip to content

Commit

Permalink
Bump to 4.0.0, remove backwards compatibility typealiases (#1768)
Browse files Browse the repository at this point in the history
  • Loading branch information
calda authored Oct 12, 2022
1 parent a365e93 commit 940fbfe
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 60 deletions.
8 changes: 0 additions & 8 deletions Sources/Private/Utility/Primitives/VectorsExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ extension Double {
}
}

// MARK: - Vector2D

@available(*, deprecated, renamed: "LottieVector2D", message: """
`Lottie.Vector2D` has been renamed to `LottieVector2D` for consistency with \
the new `LottieVector3D` type. This notice will be removed in Lottie 4.0.
""")
public typealias Vector2D = LottieVector2D

// MARK: - LottieVector2D

/// Needed for decoding json {x: y:} to a CGPoint
Expand Down
8 changes: 0 additions & 8 deletions Sources/Public/Animation/LottieAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ public enum CoordinateSpace: Int, Codable {
case type3d
}

// MARK: - Animation

@available(*, deprecated, renamed: "LottieAnimation", message: """
`Lottie.Animation` has been renamed to `LottieAnimation`, to prevent conflicts \
with the `SwiftUI.Animation` type. This notice will be removed in Lottie 4.0.
""")
public typealias Animation = LottieAnimation

// MARK: - LottieAnimation

/// The `LottieAnimation` model is the top level model object in Lottie.
Expand Down
8 changes: 0 additions & 8 deletions Sources/Public/Animation/LottieAnimationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ extension LottieLoopMode: Equatable {
}
}

// MARK: - AnimationView

@available(*, deprecated, renamed: "LottieAnimationView", message: """
`AnimationView` has been renamed to `LottieAnimationView`, for consistency with \
the new `LottieAnimation` type. This notice will be removed in Lottie 4.0.
""")
public typealias AnimationView = LottieAnimationView

// MARK: - LottieAnimationView

@IBDesignable
Expand Down
8 changes: 0 additions & 8 deletions Sources/Public/Primitives/LottieColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ public enum ColorFormatDenominator: Hashable {
}
}

// MARK: - Color

@available(*, deprecated, renamed: "LottieColor", message: """
`Lottie.Color` has been renamed to `LottieColor`, to prevent conflicts with \
the `SwiftUI.Color` type. This notice will be removed in Lottie 4.0.
""")
public typealias Color = LottieColor

// MARK: - LottieColor

public struct LottieColor: Hashable {
Expand Down
16 changes: 0 additions & 16 deletions Sources/Public/Primitives/Vectors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@

import Foundation

// MARK: - Vector1D

@available(*, deprecated, renamed: "LottieVector1D", message: """
`Lottie.Vector1D` has been renamed to `LottieVector1D` for consistency with \
the new `LottieVector3D` type. This notice will be removed in Lottie 4.0.
""")
public typealias Vector1D = LottieVector1D

// MARK: - LottieVector1D

public struct LottieVector1D: Hashable {
Expand All @@ -27,14 +19,6 @@ public struct LottieVector1D: Hashable {

}

// MARK: - Vector3D

@available(*, deprecated, renamed: "LottieVector3D", message: """
`Lottie.Vector3D` has been renamed to `LottieVector3D`, to prevent conflicts with \
the Apple SDK `Spatial.Vector3D` type. This notice will be removed in Lottie 4.0.
""")
public typealias Vector3D = LottieVector3D

// MARK: - LottieVector3D

/// A three dimensional vector.
Expand Down
6 changes: 3 additions & 3 deletions Tests/SnapshotConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extension SnapshotConfiguration {
AnimationKeypath(keypath: "X Outlines.Group 1.Stroke 1.Color"): ColorValueProvider(.black),
AnimationKeypath(keypath: "Switch Outline Outlines.Fill 1.Color"): ColorValueProvider([
Keyframe(value: LottieColor.black, time: 0),
Keyframe(value: Color(r: 0.76, g: 0.76, b: 0.76, a: 1), time: 75),
Keyframe(value: LottieColor(r: 0.76, g: 0.76, b: 0.76, a: 1), time: 75),
Keyframe(value: LottieColor.black, time: 150),
]),
]),
Expand Down Expand Up @@ -166,7 +166,7 @@ extension SnapshotConfiguration {
// MARK: - LottieColor helpers

extension LottieColor {
static let black = Color(r: 0, g: 0, b: 0, a: 1)
static let red = Color(r: 1, g: 0, b: 0, a: 1)
static let black = LottieColor(r: 0, g: 0, b: 0, a: 1)
static let red = LottieColor(r: 1, g: 0, b: 0, a: 1)
}
#endif
6 changes: 3 additions & 3 deletions Tests/ValueProvidersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ final class ValueProvidersTests: XCTestCase {

let keypath = AnimationKeypath(keypath: "A1.Shape 1.Stroke 1.Color")
animationView.setValueProvider(ColorValueProvider(.red), keypath: keypath)
let updatedColor = try XCTUnwrap(animationView.getValue(for: keypath, atFrame: 0) as? Color)
let updatedColor = try XCTUnwrap(animationView.getValue(for: keypath, atFrame: 0) as? LottieColor)
XCTAssertEqual(updatedColor, .red)

let originalColor = try XCTUnwrap(animationView.getOriginalValue(for: keypath, atFrame: 0) as? Color)
XCTAssertEqual(originalColor, Color(r: 0.4, g: 0.16, b: 0.7, a: 1))
let originalColor = try XCTUnwrap(animationView.getOriginalValue(for: keypath, atFrame: 0) as? LottieColor)
XCTAssertEqual(originalColor, LottieColor(r: 0.4, g: 0.16, b: 0.7, a: 1))
}

}
4 changes: 2 additions & 2 deletions lottie-ios.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'lottie-ios'
s.version = '3.5.0'
s.version = '4.0.0'
s.summary = 'A library to render native animations from bodymovin json'

s.description = <<-DESC
Expand All @@ -19,7 +19,7 @@ Lottie enables designers to create and ship beautiful animations without an engi

s.homepage = 'https://github.com/airbnb/lottie-ios'
s.license = { :type => 'Apache', :file => 'LICENSE' }
s.author = { 'Brandon Withrow' => '[email protected]' }
s.author = { 'Brandon Withrow' => '[email protected]', 'Cal Stephens' => '[email protected]' }
s.source = { :git => 'https://github.com/airbnb/lottie-ios.git', :tag => s.version.to_s }

s.swift_version = '5.3'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lottie-ios",
"version": "3.5.0",
"version": "4.0.0",
"description": "Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with bodymovin and renders the vector animations natively on mobile and through React Native!",
"main": "index.js",
"scripts": {
Expand All @@ -10,7 +10,7 @@
"type": "git",
"url": "git+https://github.com/airbnb/lottie-ios.git"
},
"author": "Brandon Withrow <[email protected]>",
"author": "Brandon Withrow <[email protected]>, Cal Stephens <[email protected]>",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/airbnb/lottie-ios/issues"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ViewController: NSViewController {

override func viewDidLoad() {
super.viewDidLoad()
let animationView = AnimationView()
let animationView = LottieAnimationView()
view.addSubview(animationView)
}

Expand Down
2 changes: 1 addition & 1 deletion script/test-carthage/CarthageTest/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
let animationView = AnimationView()
let animationView = LottieAnimationView()
view.addSubview(animationView)
}

Expand Down

0 comments on commit 940fbfe

Please sign in to comment.