Imagine you're trying to scale a layer and then later read that scale back out (for example: during an animation that's changing the scale).
let desiredScale = 0.5
layer.transform = CATransform3DMakeScale(desiredScale, desiredScale, 1)
let readScale = layer.value(forKeyPath: "transform.scale") as? Double
print("scale: \(readScale)") // "scale: 0.6666666"
The scale value read out using value(forKeyPath:) will be close but not quite right!
This is probably because the value read out has something to do with the whole 3D scale (think in x, y, and z). Reading out the x or y scale specifically will return the right value: