Skip to content

stleamist/OnLoad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OnLoad

A SwiftUI equivalent of viewDidLoad().

Usage

import SwiftUI
import OnLoad

struct ContentView: View {
    var body: some View {
        TabView {
            ForEach(1..<6) { number in
                Text("Tab \(number)")
                    .onLoad {
                        print("onLoad \(number)")
                    }
                    .onAppear {
                        print("onAppear \(number)")
                    }
                    .tabItem {
                        Image(systemName: "\(number).square.fill")
                        Text("Tab \(number)")
                    }
            }
        }
    }
}

About

A SwiftUI equivalent of viewDidLoad().

Resources

Stars

6 stars

Watchers

1 watching

Forks

Contributors

Languages