view Simoleon/Functions/ConditionalWrapper.swift @ 193:7bd79287b955

Add images to readme
author Dennis C. M. <dennis@denniscm.com>
date Wed, 20 Nov 2024 08:59:21 +0000
parents 2fc95efcb1ee
children
line wrap: on
line source

//
//  ConditionalWrapper.swift
//  Simoleon
//
//  Created by Dennis Concepción Martín on 8/12/21.
//

import SwiftUI

// MARK: Wrap view with some content given a condition
extension View {
    @ViewBuilder
    func `if`<Content: View>(_ conditional: Bool, content: (Self) -> Content) -> some View {
        if conditional {
            content(self)
        } else {
            self
        }
    }
}