Toast-Swift
Toast-Swift copied to clipboard
Toast will be covered by keyboardView
I have a non-verified solution. It works for me on an iPhone with iOS 14.4, and this is enough for my immediate purposes. It works for
let view = UIApplication.shared.windows.last!.subviews.last!
my change for func centerPoint is to add to case .bottom:
the folowing:
if UIApplication.shared.isKeyboardPresented {
return CGPoint(x: superview.bounds.size.width / 2.0, y: (superview.bounds.size.height - (toast.frame.size.height / 2.0)) - bottomPadding -
UIApplication.shared.windows.last!.subviews.last!.subviews.last!.frame.height)
}
here, isKeyboardPresented is taken from https://stackoverflow.com/a/52417737/192373