---
title: "Converting Proxies to Strings"
url: https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings
language: swift
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Converting Proxies to Strings

Programming language: Swift. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/php.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/invocation/converting-proxies-to-strings/ruby.md).

This page describes how an application can *stringify* a proxy and create a property dictionary that captures all the proxy's properties.

## Stringifying a Proxy

You can stringify a proxy by calling `ice_toString` on this proxy, or by reading its `description` property (from protocol [CustomStringConvertible](https://developer.apple.com/documentation/swift/customstringconvertible)). For example:

```swift
let greeter = try makeProxy(
    communicator: communicator,
    proxyString: "greeter:tcp -h localhost -p 4061",
    type: GreeterPrx.self)

let s = greeter.description;
```

`ice_toString` (or `description`, which is equivalent) stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the [Ice.ToStringMode](https://docs.zeroc.com/ice/3.8/property-reference/ice-properties/swift.md#ice.tostringmode) property.

## Proxy to Property

You can also perform a deeper proxy stringification by calling `proxyToProperty` on your communicator. For example:

```swift
let greeter = try makeProxy(
    communicator: communicator,
    proxyString: "greeter:tcp -h localhost -p 4061",
    type: GreeterPrx.self)
let proxyDict = communicator.proxyToProperty(proxy: greeter, property: "Greeter")
```

The resulting map or dictionary holds all the [proxy properties](https://docs.zeroc.com/ice/3.8/property-reference/proxy-properties/swift.md) for the supplied proxy, except its [Context](https://docs.zeroc.com/ice/3.8/property-reference/proxy-properties/swift.md#name.context.key) properties. The second parameter of `proxyToProperty` is the base name for the [properties](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/properties-overview/swift.md) in the returned map.

## See Also

- [Obtaining Proxies](https://docs.zeroc.com/ice/3.8/runtime/invocation/creating-proxies/swift.md)
- [Proxy and Endpoint Syntax](https://docs.zeroc.com/ice/3.8/runtime/endpoint-syntax/swift.md)
- [Proxy Properties](https://docs.zeroc.com/ice/3.8/property-reference/proxy-properties/swift.md)
