Hi Claude31,Thank you! Even though it seem counter intuitive to me to make an empty view for the navigationlink itself, and then add a button to trigger it, it works for me.
Post
Replies
Boosts
Views
Activity
I encountered the same situation when running app in simulator. I found that it is only for simulator with iOS 13.3. Below are my test resultsiPhone 8 simulator with iOS 13.3 --- there is issue: NavigationLink no long work after navigating backiPhone 8 simulator with iOS 13.2.2 --- OKa physical iPhone with iOS 13.3 --- OKluckly seems this is a simulator only issue and it is only for iOS 13.3. I hope it can be fixed in next iOS version.
If your app has NavigationView, you can check whether it have the same situation as this threadhttps://forums.developer.apple.com/thread/119691The display of NavigationView will be broken if not configured properly.
Thank you jonsteinmetz! I encountered similar issue and your solution works for me.
I am glad that this time seems I did something useful for the community 🙂
A solution is figured out: I don't need to use the viewWillTransition event. Below is the code I wrote:import SwiftUI
import GoogleMobileAds
import UIKit
struct ContentView: View {
var body: some View {
VStack(alignment: .leading) {
AdView().frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 300).border(Color.red, width: 5)
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.border(Color.yellow, width: 2)
}
}
struct AdView : UIViewRepresentable {
@State private var banner: GADBannerView = GADBannerView(adSize: kGADAdSizeBanner)
func makeUIView(context: UIViewRepresentableContext<AdView>) -> GADBannerView {
banner.adUnitID = "ca-app-pub-3940256099942544/2934735716"
banner.rootViewController = UIApplication.shared.windows.first?.rootViewController
banner.load(GADRequest())
return banner
}
func updateUIView(_ uiView: GADBannerView, context: UIViewRepresentableContext<AdView>) {
banner.adSize = kGADAdSizeBanner
banner.load(GADRequest())
}
}When the device (in simulator) rotates, the AD size changed.
Hi KMT and Jim Dovey,I submitted a bug report in https://feedbackassistant.apple.com/feedback/7496464Not get getting response. For now I am more frequently using online document.Thank you!
Hi Claude31,My original purpose is to display a long list of content without realizing List can already scroll. Now the problem is resolved. Thank you!
Hi Jim Dovey, You are right. I didn't realize that List can already let me scroll for the content more than one screen. The ForEach solution works for me because it seems to support more than 10 items inside.Thank you!struct ContentView: View {
var body: some View {
List {
ForEach(1 ... 100, id: \.self ) {
x in
VStack {
Text("dfsf")
Text("sfsdfj")
}
}
}.padding(10)
}
}