Created
August 22, 2021 14:29
-
-
Save ANSCoder/6841bf331127cb63d66cad4c0d7cfbe6 to your computer and use it in GitHub Desktop.
Solution for Create Controller inside NavigationButton lazily in SwiftUI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LazyView.swift | |
// Grocers | |
// | |
// Created by Anand Nimje on 10/09/20. | |
// Copyright © 2020 Anscoder. All rights reserved. | |
// | |
import SwiftUI | |
/// Create destination View inside the NavigationButton lazily. | |
struct LazyView<Content: View>: View { | |
let build: () -> Content | |
init(_ build: @autoclosure @escaping () -> Content) { | |
self.build = build | |
} | |
var body: Content { | |
build() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uses for this Lazy view inside the SwiftUI