<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCoder/string(for:)-4omzv",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSStringFromCGVector"
  },
  "title" : "string(for:)"
}
-->

# string(for:)

Returns a string formatted to contain the data from a vector data structure.

```
class func string(for vector: CGVector) -> String
```

## Parameters

`vector`

A Core Graphics structure representing a two-dimensional vector.

## Return Value

A string that corresponds to `vector`. See [`cgVector(for:)`](/documentation/Foundation/NSCoder/cgVector(for:)) for a discussion of the string format.

## Discussion

---

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)