diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditTextComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditTextComponent.swift index c9dba08..e1a4669 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditTextComponent.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditTextComponent.swift @@ -28,20 +28,6 @@ struct EditTextComponent: View { } } -extension View { - func placeholder( - when shouldShow: Bool, - alignment: Alignment = .leading, - @ViewBuilder placeholder: () -> Content) -> some View { - - ZStack(alignment: alignment) { - placeholder().opacity(shouldShow ? 1 : 0) - self - } - } -} - - struct EditTextComponent_Previews: PreviewProvider { static var previews: some View { EditTextComponent(explanation: "Nom du Joueur 1", name: .constant("Joueur 1")) diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Extension/Placeholder.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Extension/Placeholder.swift index e69de29..948fa1b 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/Extension/Placeholder.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Extension/Placeholder.swift @@ -0,0 +1,22 @@ +// +// Placeholder.swift +// ArkitDoushiQi +// +// Created by Louis DUFOUR on 14/06/2024. +// + +import Foundation +import SwiftUI + +extension View { + func placeholder( + when shouldShow: Bool, + alignment: Alignment = .leading, + @ViewBuilder placeholder: () -> Content) -> some View { + + ZStack(alignment: alignment) { + placeholder().opacity(shouldShow ? 1 : 0) + self + } + } +}