🇨🇳🐲🎉 本网站的中文版本尚处早期开发阶段。如果您发现其中存在错字、纰漏或其他任何问题,请随时联系 [email protected] 向我反馈。
命令

命令在 Swift 中的实现

Command is behavioral design pattern that converts requests or simple operations into objects.

The conversion allows deferred or remote execution of commands, storing command history, etc.

Learn more about Command

在 Swift 中使用模式

Complexity: Low

Popularity: High

Usage examples: The Command pattern is pretty common in Swift code. Most often it's used as an alternative for callbacks to parameterizing UI elements with actions. It's also used for queueing tasks, tracking operations history, etc.

Identification: The Command pattern is recognizable by behavioral methods in an abstract/interface type (sender) which invokes a method in an implementation of a different abstract/interface type (receiver) which has been encapsulated by the command implementation during its creation. Command classes are usually limited to specific actions.

命令在其他编程语言中的实现

命令 在 Java 中的实现 命令 在 C# 中的实现 命令 在 PHP 中的实现 命令 在 Python 中的实现 命令 在 Ruby 中的实现 命令 在 TypeScript 中的实现