I am trying to add an image into my textinput in swiftui without the use of a zstack because this cause the whole view to bug, this is the expected result , is there a way to add them without the use of a stack? or should i adapt the whole code based on it ?
HStack {
ZStack {
CustomTextField(placeholder: "Email", text: $email, textColor: .black, isValid: emailValid)
.focused($isEmailFocused)
if let isValid = emailValid {
Image(isValid ? "check_solid" : "cancel_solid")
.resizable()
.frame(width: 25, height: 25)
.foregroundColor(isValid ? Color("greenstrokes") : Color("redstrokes"))
.position(x: UIScreen.main.bounds.width - 100, y: 75)
}
}
}
ZStackand adding aSpacer()after theCustomTextField?CustomTextField, usingalignment: .trailing?