<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIShape-swift.struct",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit7UIShapeV"
  },
  "title" : "UIShape"
}
-->

# UIShape

An abstract representation of a shape.

```
struct UIShape
```

## Overview

A [`UIShape`](/documentation/UIKit/UIShape-swift.struct) can represent different types of shapes, including:

- A simple shape like a rectangle or circle that resolves into a concrete shape according to context (like size and position)
- A Bézier path
- A dynamic shape that resolves using a custom closure

You typically use a [`UIShape`](/documentation/UIKit/UIShape-swift.struct) with APIs like [`UIHoverStyle`](/documentation/UIKit/UIHoverStyle) to represent the shape of an effect.

## Topics

### Creating a hover shape

[`static var rect: UIShape`](/documentation/UIKit/UIShape-swift.struct/rect)

Creates a rectangular shape.

[`static var capsule: UIShape`](/documentation/UIKit/UIShape-swift.struct/capsule)

Creates a capsule shape, a rounded rectangle with a corner radius equal to half the length of the rectangle’s smallest edge.

[`static var circle: UIShape`](/documentation/UIKit/UIShape-swift.struct/circle)

Creates a circular shape, with a radius equal to half the length of the frame rectangle’s smallest edge.

[`static func rect(cornerRadius: CGFloat, cornerCurve: UICornerCurve, maskedCorners: UIRectCorner) -> UIShape`](/documentation/UIKit/UIShape-swift.struct/rect(cornerRadius:cornerCurve:maskedCorners:))

Creates a rectangular shape with rounded corners, using the provided corner radius, corner curve, and rectangle corners.

[`static func fixedRect(CGRect, cornerRadius: CGFloat, cornerCurve: UICornerCurve, maskedCorners: UIRectCorner) -> UIShape`](/documentation/UIKit/UIShape-swift.struct/fixedRect(_:cornerRadius:cornerCurve:maskedCorners:))

Creates a fixed rectangular shape that uses the provided rectangle as its shape, regardless of the frame that contains it.

[`enum UICornerCurve`](/documentation/UIKit/UICornerCurve)

The corner curve to apply to a view.

### Creating a hover shape from a custom path

[`static func path(UIBezierPath) -> UIShape`](/documentation/UIKit/UIShape-swift.struct/path(_:))

Creates a shape with a custom Bézier path.

### Creating a dynamic hover shape

[`init(some UIShapeProvider)`](/documentation/UIKit/UIShape-swift.struct/init(_:))

Creates a dynamic shape that resolves using the provided resolver closure and resolution context.

[`protocol UIShapeProvider`](/documentation/UIKit/UIShapeProvider-60loj)

An interface for a type that provides a custom shape by resolving it dynamically based on a context.

[`struct ResolutionContext`](/documentation/UIKit/UIShape-swift.struct/ResolutionContext)

The context for resolving a dynamic shape.

[`struct Resolved`](/documentation/UIKit/UIShape-swift.struct/Resolved)

A shape that has completely resolved based on a context.

### Creating a shape by applying insets

[`func inset(by: UIEdgeInsets) -> UIShape`](/documentation/UIKit/UIShape-swift.struct/inset(by:)-5jxgl)

Creates a new modified shape by applying the provided insets to this shape.

[`func inset(by: CGFloat) -> UIShape`](/documentation/UIKit/UIShape-swift.struct/inset(by:)-7v5nk)

Creates a new modified shape by applying the provided inset to this shape.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Escapable`](/documentation/Swift/Escapable)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`UIShapeProvider-60loj`](/documentation/UIKit/UIShapeProvider-60loj)

[`Copyable`](/documentation/Swift/Copyable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)