---
title: "NSSizeFromString(_:)"
framework: foundation
role: symbol
role_heading: Function
path: "foundation/nssizefromstring(_:)"
---

# NSSizeFromString(_:)

Returns an NSSize from a text-based representation.

## Declaration

```swift
func NSSizeFromString(_ aString: String) -> NSSize
```

## Discussion

Discussion Scans aString for two numbers which are used as the width and height, in that order, to create an NSSize struct. If aString only contains a single number, it is used as the width. The aString argument should be formatted like the output of NSStringFromSize(_:), for example, @"{10,20}". If aString does not contain any numbers, this function returns an NSSize struct whose width and height are both 0.

## See Also

### Managing Sizes

- [NSEqualSizes(_:_:)](foundation/nsequalsizes(_:_:).md)
- [NSMakeSize(_:_:)](foundation/nsmakesize(_:_:).md)
- [NSStringFromSize(_:)](foundation/nsstringfromsize(_:).md)
- [NSSizeFromCGSize(_:)](foundation/nssizefromcgsize(_:).md)
- [NSSizeToCGSize(_:)](foundation/nssizetocgsize(_:).md)
