[Swift] An illustration for those who say "Delegate is an agent."

Introduction

Anyone who started Swift would have thought first Teaching materials / articles "Delegate is an agent .." Reader "What is an agent?"

In this article, I will introduce Delegate graphically and explain how to use it. By the time you finish reading "I see, Delegate is an agent." You're probably thinking.

Understand Delegate

スクリーンショット 2020-09-29 21.32.32.png Below, the protocol PopViewDelegate: UIView part is incorrect class PopupView: It will be UIView.

スクリーンショット 2020-09-29 21.36.38.png

At the end

What did you think? I think you thought, "Delegate is an agent." If anyone around you is having trouble understanding Delegate, please do Please introduce this article.

Recommended Posts

[Swift] An illustration for those who say "Delegate is an agent."
[Swift] This is the solution! Illustration of Delegate implementation
Comparison memo for those who touch Kotlin (Android) from Swift (iOS) 1