I'm trying to implement some animation via CAAnimation, So I'm finding some references via google.
And I found so many examples are achieve the goal using String "urSoBasic" as a key, like below:
shapeLayer.add(basicAnimation, forKey: "urSoBasic")
The developer documents describing about special key "transition", only about key has to be unique.
Briefly, Is there any function of the key "urSoBasic"? or It's just about convention? It's confusing.
I want to know what exactly "urSoBasic" means.
CodePudding user response:
The key "urSoBasic" is a joke or a play on words. "urSoBasic" -> "you are so basic". Someone was being cute when they named their basic animation key as "urSoBasic". And then it got copied and pasted a bunch which is why you might find it in various search results.
The value of the forKey:
parameter is an arbitrary string that only has meaning to you and your code. It's not even required.
From the documentation for the CALayer add(_:forKey:)
method:
A string that identifies the animation. Only one animation per unique key is added to the layer. The special key
kCATransition
is automatically used for transition animations. You may specifynil
for this parameter.
tl;dr - "urSoBasic" has no special meaning that would affect the functionality of the code.