Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 2 additions & 9 deletions Sources/Layout/LayoutItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ public typealias SuperviewConstraints = (LayoutItem) -> [NSLayoutConstraint]
* Each subview and its constraints are stored as a `LayoutItem` instance within a ``Layout``. A `LayoutItem` extension
* is provided that defines the declarative methods used to create constraints for the subviews within a layout.
*
* A layout item must be added to a `Layout` in order to activate its constraints, as the following code demonstrates:
* A layout item must be added to a `Layout` in order to activate its constraints, as shown in the following code:
*
* ```swift
* // Creating a layout with a single item
* let item: LayoutItem = subview.toEdges()
* view.layout(item).activate()
*
* // Creating a layout with multiple items
* let item1: LayoutItem = subview1.toEdges()
* let item2: LayoutItem = subview2.square().center()
* view.layout(item1).addItem(item2).activate()
* view.layout(subview.toEdges()).activate()
* ```
*
* The following code demonstrates the preferred way of constructing and activating a layout with multiple items
Expand Down
32 changes: 0 additions & 32 deletions Tests/LayoutTests/LayoutExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,38 +175,6 @@ final class LayoutExampleTests: XCTestCase {

// MARK: - LayoutItem

@MainActor
func testSingleLayoutItemDocumentationExample() {

// GIVEN

let subview: UIView = .blue()

// THEN

assertLayout { view in
let item: LayoutItem = subview.toEdges()
view.layout(item).activate()
}
}

@MainActor
func testMultipleLayoutItemsDocumentationExample() {

// GIVEN

let subview1: UIView = .orange()
let subview2: UIImageView = .init(image: .checkmark)

// THEN

assertLayout { view in
let item1: LayoutItem = subview1.toEdges()
let item2: LayoutItem = subview2.square().center()
view.layout(item1).addItem(item2).activate()
}
}

@MainActor
func testHorizontallyCenteringLayoutItemDocumentationExample() {

Expand Down
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.