Swift: Layout Anchors

In general, Swift provides as with 11 layout anchors which can be configured to create constraints using auto layout programatically. They are divided into three groups as follows:

Horizontal constraint

  • centerXAnchor
  • leadingAnchor
  • trailingAnchor
  • leftAnchor
  • rightAnchor

Vertical constraint

  • centerYAnchor
  • bottomAnchor
  • topAnchor
  • firstBAseLineAnchor
  • lastBaseLineAnchor

size-based constraint

  • heightAnchor
  • widthAnchor

 

 

Leave a Reply