24.3 The onAppear and onDisappear Modifiers
The most basic and frequently used modifiers are onAppear() and onDisappear(). When applied to a view, these modifiers allow actions to be performed at the point that the view appears or disappears.
Within the FirstTabView.swift file, add both modifiers to the Text view as follows:
import SwiftUI
struct FirstTabView: View {
var body: some View {
Text("View One")
.onAppear(perform: {
print("onAppear triggered")
})
.onDisappear(perform: {
...