Skip to content

Instantly share code, notes, and snippets.

View Ahattalla's full-sized avatar
🏠
Working from home

Ahmed Attalla Ahattalla

🏠
Working from home
  • Cairo , Egypt
View GitHub Profile
@Ahattalla
Ahattalla / proxy-design-pattern.swift
Last active July 9, 2023 05:34
Proxy design pattern example in swift
/*
# Proxy design pattern
- Intent: It provides a surrogate or a placeholder for another object, to control access to it (the original object)
- Types:
- Virtual proxy (Lazy initialization). This is when you have a heavyweight service object that wastes system resources by being always up, even though you only need it from time to time.
- Protection proxy(as in Spotify for subscribers content). This is when you want only specific clients to be able to use the service object; for instance, when your objects are crucial parts of an operating system and clients are various launched applications (including malicious ones).
- Caching proxy (like kingfisher as an example).