🎉 Hooray! After 3 years of work, I've finally released the ebook on design patterns! Check it out »
Proxy

Proxy in Swift

Proxy is a Conceptual design pattern that provides an object that acts as a substitute for a real service object used by a client. Proxy receives client requests, does some work (access control, caching, etc.) and then passes request to a service object.

The proxy object has the same interface as a service, which makes it interchangeable with a real object when passed to a client.

Learn more about Proxy

Usage of the pattern in Swift

Complexity:

Popularity:

Usage examples: While the Proxy pattern isn’t a frequent guest in most Swift applications, it’s still very handy in some special cases. It’s irreplaceable when you want to add some additional behaviors to an object of some existing class without changing the client code.

Identification: Proxies delegate all of the real work to some other object. Each proxy method should in the end refer to a service object unless the proxy is a subclass of a service.

Proxy in Other Languages

Proxy in Java Proxy in C# Proxy in PHP Proxy in Python Proxy in Ruby Proxy in TypeScript