Skip to content

Commit

Permalink
add view(as:) modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed Jan 30, 2025
1 parent 1340d33 commit 06863bc
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ extension Component {
ViewWrapperComponent(component: self)
}

/// Wraps the component in a `View`.
/// - Parameter viewType: The type of view to use as the wrapper.
/// - Returns: A `ViewWrapperComponent` that renders the component within a `View`.
public func view<View: UIView>(as viewType: View.Type) -> ViewWrapperComponent<View> {
ViewWrapperComponent(component: self)
}

/// Wraps the component in a `UIScrollView`.
/// - Returns: A `ViewWrapperComponent` that renders the component within a `UIScrollView`.
public func scrollView() -> ViewWrapperComponent<UIScrollView> {
Expand Down

0 comments on commit 06863bc

Please sign in to comment.