Swiftpack.co - stleamist/OnLoad as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by stleamist.
stleamist/OnLoad v1.1.0
A SwiftUI equivalent of viewDidLoad().
⭐️ 5
🕓 3 years ago
iOS macOS watchOS tvOS
.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: 5
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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