Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Sources/FlexUI/Classes/Extensions/FlexUI+UIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,37 @@ public extension FlexUI where Component: UIView {
component.setContentCompressionResistancePriority(priority, for: axis)
return self
}

/// Adds a view to the end of the receiver’s list of subviews.
///
/// - Parameter view: The view to be added. After being added, this view appears on top of any other subviews.
/// - Returns: The current instance, allowing method chaining.
@discardableResult
@MainActor
func addSubview(_ view: UIView) -> Self {
component.addSubview(view)
return self
}

/// Adds an array of views to the end of the receiver’s list of subviews.
///
/// - Parameter views: An array of views to be added.
/// - Returns: The current instance, allowing method chaining.
@discardableResult
@MainActor
func addSubviews(_ views: [UIView]) -> Self {
views.forEach { component.addSubview($0) }
return self
}

/// Adds multiple views as variadic parameters to the end of the receiver’s list of subviews.
///
/// - Parameter views: A variable number of views to be added.
/// - Returns: The current instance, allowing method chaining.
@discardableResult
@MainActor
func addSubviews(_ views: UIView...) -> Self {
views.forEach { component.addSubview($0) }
return self
}
}
Loading