<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.0.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSDistantObject/proxyWithLocal:connection:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDistantObject(cm)proxyWithLocal:connection:"
  },
  "title" : "proxyWithLocal:connection:"
}
-->

# proxyWithLocal:connection:

Returns a local proxy for a given object and connection, creating the proxy if necessary.

```
+ (id) proxyWithLocal:(id) target connection:(NSConnection *) connection;
```

## Parameters

`target`

An object in the receiver’s address space.

`connection`

The connection for the returned proxy.

## Return Value

A local proxy for `target` and `connection`, creating it if necessary.

## Discussion

Other applications connect to the proxy using the `NSConnection` [`connectionWithRegisteredName:host:`](/documentation/Foundation/NSConnection/connectionWithRegisteredName:host:) class method.

Local proxies should be considered private to their `NSConnection` objects. Only an `NSConnection` object should use this method to create them, and your code shouldn’t retain or otherwise use local proxies.

## See Also

  [Distributed Objects Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DistrObjects/DistrObjects.html#//apple_ref/doc/uid/10000102i)



---

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)