Skip to content

Instantly share code, notes, and snippets.

@ANSCoder
Created August 22, 2021 14:29
Show Gist options
  • Select an option

  • Save ANSCoder/6841bf331127cb63d66cad4c0d7cfbe6 to your computer and use it in GitHub Desktop.

Select an option

Save ANSCoder/6841bf331127cb63d66cad4c0d7cfbe6 to your computer and use it in GitHub Desktop.

Revisions

  1. ANSCoder created this gist Aug 22, 2021.
    20 changes: 20 additions & 0 deletions LazyView.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    //
    // 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()
    }
    }