top of page
Writer's pictureHui Wang

71. Article: viewDidLoad() in SwiftUI

If you come from the UIKit world, you might wonder what the viewDidLoad() equivalent method in SwiftUI is.


Too bad there is no direct replacement of viewDidLoad() in SwiftUI.


The closest SwiftUI's methods we have are onAppear() and onDisappear() which is equivalents to UIKit's viewDidAppear() and viewDidDisappear().


If you really want the behavior of viewDidLoad(), you have to implement it yourself.


Luckily, the process is not that hard, and this article will help you.





References:


viewDidLoad() in SwiftUI:


 

Follow me on:

Comments


bottom of page