Skip to content

t19960804/TLUI

Repository files navigation

Components

  • TLButton
  • TLCollectionView
  • TLImageView
  • TLLabel
  • TLTopCornerView
  • TLView

How to use?

Center In Super View
let sampleView = TLView(backgroundColor: .red)
view.addSubview(sampleView)

sampleView.centerInSuperView(size: .init(width: 150, height: 150))

Demo

Add Top / Left Anchor
let sampleView = TLView(backgroundColor: .red)
view.addSubview(sampleView)

sampleView.addConstraints(leadingAnchorTuple: (view.leadingAnchor, 50), topAnchorTuple: (view.topAnchor, 50))
sampleView.addHeightConstraint(equalToConstant: 150)
sampleView.addWidthConstraint(equalToConstant: 150)

Demo

Add Same Anchor With Other Views
let sampleView = TLView(backgroundColor: .red)
let sampleView2 = TLView(backgroundColor: .blue)

view.addSubview(sampleView)
view.addSubview(sampleView2)

sampleView.centerInSuperView(size: .init(width: 100, height: 100))
sampleView2.addConstraints(trailingAnchorTuple: (sampleView.leadingAnchor, 0) ,bottomAnchorTuple: (sampleView.topAnchor, 0))
sampleView2.addWidthConstraint(equalTo: sampleView.widthAnchor)
sampleView2.addHeightConstraint(equalTo: sampleView.heightAnchor)

Demo

Installation

  • Swift Package Manager

Requirements

  • iOS 13 +
  • Swift 5 +