# `GSPath pathWithRect:`

*Initializer*

Creates a closed rectangular path enclosing the rectangle.

## Declaration

```swift
convenience init?(rect: CGRect)
```

```objc
+ (instancetype) pathWithRect:(CGRect) rect;
```

```python
pathWithRect_(rect: CGRect) -> GSPath
```

## Discussion

Returns `nil` when the rectangle is empty or null.

## See Also

### Creating a Path

- [`GSPath initWithDict:format:`](/Core/GlyphsCore/GSPath/initWithDict:format:) — Creates a path from a Glyphs file dictionary representation.
- [`GSPath initWithGlyphsParser:format:`](/Core/GlyphsCore/GSPath/initWithGlyphsParser:format:) — Creates a path from the Glyphs file representation at the current parser position.
- [`GSPath pathWithString:isClosed:`](/Core/GlyphsCore/GSPath/pathWithString:isClosed:) — Creates a path from a sequence of node element strings.
- [`GSPath circleWithRect:`](/Core/GlyphsCore/GSPath/circleWithRect:) — Creates a closed cubic path approximating an ellipse inside the rectangle.
- [`GSPath circleWithCenter:radius:`](/Core/GlyphsCore/GSPath/circleWithCenter:radius:) — Creates a closed cubic path approximating a circle.
- [`GSPath ellipseWithCenter:radius1:radius2:angle:`](/Core/GlyphsCore/GSPath/ellipseWithCenter:radius1:radius2:angle:) — Creates a closed cubic path approximating an ellipse.

