Composite Views
CompositePre-built composite views combining multiple UIKit primitives into common UI patterns — key-value rows, icon-label pairs, form field rows, two-button layouts, and separators. All live in CustomView/Custom/.
| Class | Pattern |
|---|---|
LabelLeftRightView | Left label + right label (key-value row) |
IconLabelView | Icon (top) + label (bottom) vertical pair |
IconLabelHorizontalView | Icon (left) + label horizontal pair |
LabelTextFieldView | Label + text field vertical pair |
ButtonPanelView | Single prominent action button in a panel |
LineView / TTLineView | Horizontal separator line |
TTBaseLableWithButtonView | Label + button on the same row |
BaseTwoStackButtonView | Two equal-width action buttons |
RowTableView | Pre-styled key-value table row |
LableSubLabelView | Title + subtitle vertical pair |
BaseTwoButtonDiffWidthView | Two buttons with different widths |
IconLabelTextFieldHorizontalView | Icon + label + text field in a row |
TTBaseShadowView | Generic shadow wrapper for any view |
🚀 Usage Examples
// Key-value row (settings, profile details)
let row = LabelLeftRightView(
leftText: "Email",
rightText: user.email
)
// Icon + label (tab bar item alternative)
let iconLabel = IconLabelView(
icon: .heart,
label: "Favorites"
)
// Icon + label horizontal (list item)
let hRow = IconLabelHorizontalView(
icon: .mapMarker,
label: "123 Main St, Springfield"
)
hRow.iconColor = .systemRed
// Form field row (label above text field)
let fieldRow = LabelTextFieldView(label: "Phone Number")
fieldRow.textField.keyboardType = .phonePad
// Separator line
let line = LineView() // or TTLineView()
line.setHeightAnchor(constant: 1)
line.setBgColor(TTView.lineDefColor)
// Label + button on same row
let row = TTBaseLableWithButtonView(
labelText: "Remember me",
buttonText: "Learn more"
)
row.onButtonTouchHandler = { self.showInfo() }
// Two equal buttons
let twoButtons = BaseTwoStackButtonView(
leftTitle: "Cancel",
rightTitle: "Confirm"
)
twoButtons.onLeftTouchHandler = { self.dismiss(animated: true) }
twoButtons.onRightTouchHandler = { self.confirm() }
// Title + subtitle
let subtitleView = LableSubLabelView(
title: "Premium Plan",
subTitle: "$9.99 / month"
)
Pro Tip: Use
BaseTwoStackButtonView in bottom action sheets or confirmation panels. It uses TTBaseUIStackView(.fillEqually) so both buttons always share equal width — great for Cancel/Confirm patterns without manual width constraints.