[SWIFT] Screen transition method

Introduction

I designed it with 1 Storyboard — 1 ViewController in the application development in learning, but I noticed that I am always searching the net for methods for screen transitions, so I will post it as a memorandum.

The reason for designing with the above method is that the method of preparing one StoryBoard for one ViewController reduces conflicts in joint development.

Operating environment

【Xcode】Version 12.0.1 【Swift】Version 5.3

Implementation method (using navigationController)

python


//Get the transition destination View (NextViewController)
let storyboard = UIStoryboard(name: "Next", bundle: nil)
let nextVC = storyboard.instantiateViewController(withIdentifier: "NextVC") as! NextViewController
//Screen transition to NextViewController
self.navigationController?.pushViewController(nextVC, animated: true)

Implementation method (does not use navigationController)

python


//Get the transition destination View (NextViewController)
let storyboard = UIStoryboard(name: "Next", bundle: nil)
let nextVC = storyboard.instantiateViewController(withIdentifier: "NextVC") as! NextViewController
//Screen transition to NextViewController
self.present(nextVC, animated: true, completion: nil)

Implementation method (storyboard settings)

スクリーンショット 2020-11-08 20.16.46(2).png

Summary

There are still many ways to change screens, so I hope to update them as needed.

Recommended Posts

Screen transition method
Screen transition by Post method [Java]
Screen transition memorandum
JavaFX8 screen transition
[Swift] Simple screen transition summary
Android development ~ Screen transition (intent) ~
screen
Screen transition Information transfer memorandum
Animation settings at screen transition
Screen transition with swing, java
Screen transition using Intent in Kotlin
[Rails] How to prevent screen transition
[Java Swing] Screen transition by CardLayout
Java method
to_i method
java (method)
getRequestDispatcher () method
merge method
Map method
include method
Abstract method
Eclipse screen layout change method (Java version)
initialize method
Screen transition memorandum Information transfer from listview
List method
puts method
Java method
Class method
save! method
getParameter method
[Java] method
Screen transition by [Android Studio] [Java] button
private method
rails method
[Java] method