struct ChangeName: View {
@Binding var defaultName: String
@State var changeprofileName: String = ""
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
var body: some View {
TextField(self.defaultName, text: $changeprofileName).modifier(ClearButton(changeprofileName: $changeprofileName))
.navigationBarTitle(LocalizedStringKey("mypage.name.title"), displayMode: .inline)
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading:
HStack {
//TODO: 닉네임을 취소로 바꾸기
Button(action: {
self.presentationMode.wrappedValue.dismiss()
}) {
Text(LocalizedStringKey("mypage.back.button"))
}
.foregroundColor(Color.white)
},trailing:
HStack {
Button(LocalizedStringKey("mypage.save.button"))
{ /*code*/ }
}
)
}
}
출처