I was having the same problem. Now I have setup a Storekit Configuration file and it is working for testing. https://developer.apple.com/documentation/xcode/setting-up-storekit-testing-in-xcode/
Post
Replies
Boosts
Views
Activity
Same problem.
Here's a fix, With the help from https://stackoverflow.com/a/60178361/3405069
import SwiftUI
import Combine
struct AdaptsToKeyboard: ViewModifier {
@State var currentHeight: CGFloat = 0
func body(content: Content) -> some View {
GeometryReader { geometry in
content
.padding(.bottom, self.currentHeight)
.animation(.easeOut(duration: 0.5), value: currentHeight)
.onAppear(perform: {
NotificationCenter.Publisher(center: NotificationCenter.default, name: UIResponder.keyboardWillShowNotification)
.merge(with: NotificationCenter.Publisher(center: NotificationCenter.default, name: UIResponder.keyboardWillChangeFrameNotification))
.compactMap { notification in
withAnimation(.easeOut(duration: 0.16)) {
notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect
}
}
.map { rect in
rect.height - geometry.safeAreaInsets.bottom
}
.subscribe(Subscribers.Assign(object: self, keyPath: \.currentHeight))
NotificationCenter.Publisher(center: NotificationCenter.default, name: UIResponder.keyboardWillHideNotification)
.compactMap { notification in
CGFloat.zero
}
.subscribe(Subscribers.Assign(object: self, keyPath: \.currentHeight))
})
}
}
}
extension View {
func adaptsToKeyboard() -> some View {
return modifier(AdaptsToKeyboard())
}
}
Usage:
var body: some View {
NavigationView{
ZStack {
Color("Background").ignoresSafeArea()
VStack{
//Your content here
}
padding(.bottom)
}
.adaptsToKeyboard()
.edgesIgnoringSafeArea(.bottom)
}
}