From 8b8067be71a145464b09b739db909b65d7609157 Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 17 Oct 2020 19:51:22 +0200 Subject: [PATCH] Fixed view for iOS 14 --- .../extensions/ViewExtensions.swift | 19 ++++++++++++++----- .../ui/dialogs/LoginDialog.swift | 5 ++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ui/BankingiOSApp/BankingiOSApp/extensions/ViewExtensions.swift b/ui/BankingiOSApp/BankingiOSApp/extensions/ViewExtensions.swift index eb9637f0..fdb12f10 100644 --- a/ui/BankingiOSApp/BankingiOSApp/extensions/ViewExtensions.swift +++ b/ui/BankingiOSApp/BankingiOSApp/extensions/ViewExtensions.swift @@ -30,16 +30,25 @@ extension View { func customNavigationBarBackButton(_ onBackButtonPressed: @escaping () -> Void) -> some View { return self - .navigationBarHidden(false) - .navigationBarBackButtonHidden(true) - .navigationBarItems(leading: createCancelButton(onBackButtonPressed)) + .setLeadingNavigationBarButton(createCancelButton(onBackButtonPressed)) + } + + func setCancelAndDoneNavigationBarButtons(onCancelPressed: @escaping () -> Void, onDonePressed: @escaping () -> Void) -> some View { + return self + .customizeToSetLeadingNavigationBarButton() + .navigationBarItems(leading: createCancelButton(onCancelPressed), trailing: createDoneButton(onDonePressed)) } - func setCancelAndDoneNavigationBarButtons(onCancelPressed: @escaping () -> Void, onDonePressed: @escaping () -> Void) -> some View { + func setLeadingNavigationBarButton(_ leadingButton: Button) -> some View { + return self + .customizeToSetLeadingNavigationBarButton() + .navigationBarItems(leading: leadingButton) + } + + func customizeToSetLeadingNavigationBarButton() -> some View { return self .navigationBarHidden(false) .navigationBarBackButtonHidden(true) - .navigationBarItems(leading: createCancelButton(onCancelPressed), trailing: createDoneButton(onDonePressed)) } func createDoneButton(_ onDoneButtonPressed: @escaping () -> Void) -> some View { diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/LoginDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/LoginDialog.swift index 78b4e475..c2b1f321 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/LoginDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/LoginDialog.swift @@ -68,8 +68,11 @@ struct LoginDialog: View { Spacer() } + .fixKeyboardCoversLowerPart() + .systemGroupedBackground() + .edgesIgnoringSafeArea(.all) .showNavigationBarTitle("Login Dialog title") - .navigationBarItems(leading: allowCancellingLogin == false ? nil : createCancelButton { + .setLeadingNavigationBarButton(allowCancellingLogin == false ? nil : createCancelButton { self.closeDialogAndDispatchLoginResult(false) }) }