0

if i create a custom view class that inherit from the UIView Class i can access properties with the keyword layer. for example layer.cornerRadius = 10 and for example the background with backgroundColor = (Color Literal) WITHOUT layer.

Why? What means layer and when i use it and when not?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
SwiftiSwift
  • 7,528
  • 9
  • 56
  • 96
  • https://developer.apple.com/documentation/uikit/uiview/1622436-layer – Rakesha Shastri Sep 21 '18 at 16:22
  • Possible duplicate of [What are the differences between a UIView and a CALayer?](https://stackoverflow.com/questions/7826306/what-are-the-differences-between-a-uiview-and-a-calayer) – sj-r Sep 21 '18 at 17:02
  • Some properties like the backgroundColor and more are exposed for access and/or modification by the class UIView. Some are not, and can be accessed by the properties of the associated layer for the view, such as cornerRadius. – Roboris Sep 21 '18 at 18:14

0 Answers0