---
title: "string(for:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nscoder/string(for:)-4qz0a"
---

# string(for:)

Returns a string formatted to contain the data from a rectangle.

## Declaration

```swift
class func string(for rect: CGRect) -> String
```

## Parameters

- `rect`: A Core Graphics structure representing a rectangle.

## Return Value

Return Value A string that corresponds to rect. See cgRect(for:) for a discussion of the string format.

## See Also

### Representing Geometric Types as Strings

- [cgAffineTransform(for:)](foundation/nscoder/cgaffinetransform(for:).md)
- [cgPoint(for:)](foundation/nscoder/cgpoint(for:).md)
- [cgRect(for:)](foundation/nscoder/cgrect(for:).md)
- [cgSize(for:)](foundation/nscoder/cgsize(for:).md)
- [cgVector(for:)](foundation/nscoder/cgvector(for:).md)
- [nsDirectionalEdgeInsets(for:)](foundation/nscoder/nsdirectionaledgeinsets(for:).md)
- [uiEdgeInsets(for:)](foundation/nscoder/uiedgeinsets(for:).md)
- [uiOffset(for:)](foundation/nscoder/uioffset(for:).md)
- [string(for:)](foundation/nscoder/string(for:)-4omzv.md)
- [string(for:)](foundation/nscoder/string(for:)-6yx6n.md)
- [string(for:)](foundation/nscoder/string(for:)-6ix86.md)
- [string(for:)](foundation/nscoder/string(for:)-2f1xb.md)
- [string(for:)](foundation/nscoder/string(for:)-hp8b.md)
- [string(for:)](foundation/nscoder/string(for:)-26b4z.md)
- [string(for:)](foundation/nscoder/string(for:)-454dj.md)
