Swiftpack.co -  Package - stleamist/OnLoad
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
stleamist/OnLoad
A SwiftUI equivalent of viewDidLoad().
.package(url: "https://github.com/stleamist/OnLoad.git", from: "v1.1.0")

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)")
                    }
            }
        }
    }
}

GitHub

link
Stars: 0
Last commit: 4 days ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco