23 lines
416 B
Swift
23 lines
416 B
Swift
//
|
|
// View+ConditionalModifier.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 8/31/20.
|
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
extension View {
|
|
|
|
@ViewBuilder
|
|
func conditionally<Modified: View>(_ condition: Bool, modifier: (Self) -> Modified) -> some View {
|
|
if condition {
|
|
modifier(self)
|
|
} else {
|
|
self
|
|
}
|
|
}
|
|
|
|
}
|