Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit a56cd92

Browse files
author
Jeff Verkoeyen
committed
Anchor point became animatable on iOS 11.
1 parent e48cc45 commit a56cd92

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/unit/UIKitBehavioralTests.swift

+12-2
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,19 @@ class UIKitBehavioralTests: XCTestCase {
113113

114114
func testSomePropertiesImplicitlyAnimateButNotAdditively() {
115115
let baselineProperties: [AnimatableKeyPath: Any] = [
116-
.anchorPoint: CGPoint(x: 0.2, y: 0.4),
117116
.backgroundColor: UIColor.blue,
118117
.opacity: 0.5,
119118
]
120-
for (keyPath, value) in baselineProperties {
119+
let properties: [AnimatableKeyPath: Any]
120+
if #available(iOS 11.0, *) {
121+
// Anchor point became implicitly animatable in iOS 11.
122+
var baselineWithCornerRadiusProperties = baselineProperties
123+
baselineWithCornerRadiusProperties[.anchorPoint] = CGPoint(x: 0.2, y: 0.4)
124+
properties = baselineWithCornerRadiusProperties
125+
} else {
126+
properties = baselineProperties
127+
}
128+
for (keyPath, value) in properties {
121129
rebuildView()
122130

123131
UIView.animate(withDuration: 0.01) {
@@ -139,6 +147,7 @@ class UIKitBehavioralTests: XCTestCase {
139147

140148
func testSomePropertiesDoNotImplicitlyAnimate() {
141149
let baselineProperties: [AnimatableKeyPath: Any] = [
150+
.anchorPoint: CGPoint(x: 0.2, y: 0.4),
142151
.borderWidth: 5,
143152
.borderColor: UIColor.red,
144153
.cornerRadius: 3,
@@ -155,6 +164,7 @@ class UIKitBehavioralTests: XCTestCase {
155164
if #available(iOS 11.0, *) {
156165
// Corner radius became implicitly animatable in iOS 11.
157166
var baselineWithOutCornerRadius = baselineProperties
167+
baselineWithOutCornerRadius.removeValue(forKey: .anchorPoint)
158168
baselineWithOutCornerRadius.removeValue(forKey: .cornerRadius)
159169
properties = baselineWithOutCornerRadius
160170

0 commit comments

Comments
 (0)