parent
29c9f65c9d
commit
34a5392c58
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Placeholder.swift
|
||||
// ArkitDoushiQi
|
||||
//
|
||||
// Created by Louis DUFOUR on 14/06/2024.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
extension View {
|
||||
func placeholder<Content: View>(
|
||||
when shouldShow: Bool,
|
||||
alignment: Alignment = .leading,
|
||||
@ViewBuilder placeholder: () -> Content) -> some View {
|
||||
|
||||
ZStack(alignment: alignment) {
|
||||
placeholder().opacity(shouldShow ? 1 : 0)
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue