[Swift] What is dismiss?

Method to destroy the view controller itself

is. The English word means "dissolve" or "dismiss, dismiss". If you execute this on the transition destination screen, you will return to the screen before the transition. When implemented, it looks like this.

NextViewController


  //Action connected to the "Back" button
  @IBAction func returnAction(_ sender: Any) {
      dismiss(animated: true, completion: nil)
  }

I wrote it like a fixed phrase, but I didn't understand sender, animated, and completion.

sender

Meaning "sender" (send + er). The default is Any, but it seems that it is actually preferable to specify the type. In this case, specify UIButton. You can select from the pull-down when dragging and dropping with the control key. At first glance, it may be easier to understand if it says UIButton.

This article is detailed. ↓

** IBAction sender should specify a concrete type instead of Any (Swift) ** https://qiita.com/uhooi/items/e90d06e5d5681d72cbd0

animated

Presence or absence of animation. If you set it to false, the behavior will be unclear.

completion

In English, it means "complete". It's a complete thing. The default when generated semi-automatically is not nil completion: (()->void)? It is written. This seems to be related to ** closure . It seems that " the inside of the parentheses is called after the value is entered, and the outside of the parentheses is called until the value is entered **", but I can't understand it. For now, remember that "completion is about closures." ..

Recommended Posts

[Swift] What is dismiss?
[Swift] What is asynchronous processing?
[Swift] What is "inheriting a class"?
What is Cubby
What is Docker?
What is java
What is maven?
What is Jackson?
What is Docker
What is self
What is Jenkins
What is ArgumentMatcher?
What is IM-Juggling?
What is params
What is SLF4J?
What is Facade? ??
What is Java <>?
What is Gradle?
What is POJO
What is Java
What is centOS
What is RubyGem?
What is programming?
What is before_action?
What is Docker
What is Byte?
What is Tomcat
What is Swift? Findings obtained in 3 weeks
What is Maven Assembly?
What is `docker-compose up`?
What is a constructor?
What is vue cli
What is an interface?
What is Ruby's self?
What is hard coding?
What is a stream
What is Ruby's attr_accessor?
What is permission denied?
What is instance control?
What is an initializer?
What is Spring Tools 4
What is an operator?
What is object orientation?
What is MVC model?
What is an annotation?
What is Java technology?
What is Java API-java
What is @ (instance variable)?
What is Gradle's Artifact?
What is JPA Auditing?
[Java] What is flatMap?
What is a Servlet?
What is web development?
[Java] What is JavaBeans?
[Android] What is Context? ??
[Java] What is ArrayList?
[Ruby] What is true?
What is object-oriented after all?
What is HttpSession session = request.getSession ();
What is docker run -it?
What is Java Assertion? Summary.