Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kean authored Aug 30, 2024
1 parent 2bbd5aa commit cb02660
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ The best way to create constraints in code.
- **Fluent**. Concise and clear API that follows [Swift API Design Guidelines](https://swift.org/documentation/api-design-guidelines/).
- **Simple**. Stop worrying about `translatesAutoresizingMaskIntoConstraints` and constraints activation.

To give you a taste of what the *semantic* APIs look like, here is an example:
Example usage:

```swift
// Core API
anchors.top.equal(superview.top)
anchors.width.equal(anchors.height * 2)

// Semantic API
anchors.edges.pin(insets: 20) // Pins to superview
anchors.edges.pin(to: superview.safeAreaLayoutGuide, insets: 20)
anchors.width.clamp(to: 10...40)
```

And here's something a bit more powerful:

```swift
view.anchors.edges.pin(insets: 20, alignment: .center)
Expand Down

0 comments on commit cb02660

Please sign in to comment.