Chapter    18

The Proxy Pattern

I describe the proxy pattern in this chapter, which is used when an object is required to act as an interface to another object or resource. There are three main ways in which the proxy pattern is applied, and I describe each of them and show you how to implement them. Table 18-1 puts the proxy pattern into context.

Table 18-1. Putting the Proxy Pattern into Context

Question

Answer

What is it?

The proxy pattern defines an object—the proxy—that represents some other resource, such as another object or a remote service. Calling components operate on the proxy, which in turn operates on the underlying resource.

What are the benefits?

Proxies allow close control over the way that the underlying resource is accessed, which ...

Get Pro Design Patterns in Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.