Post

Replies

Boosts

Views

Activity

SwiftUI equivalent to viewWillTransition event in UIKit?
Hi! In an app implemented using SwiftUI, I want to execute some code when a view changes size. In the previous framework (UIKit), this can be done by using viewWillTransition event in UIViewController, but I cannot find a SwiftUI equivalent now. Do you have an idea how to do that?More detail of the issue I encountered:I am following the ADMOB documentation to include adaptive banner ad in the app, and the ADMOB instruction uses the viewWillTransition eventhttps://developers.google.com/admob/ios/banner/adaptiveI has successfully included a banner app using UIViewRepresentable to wrap the ADMOB object that originally supports UIKit, but just missing the way to respond to layout change of the app (more specifically, rotation).Thank you!
2
0
2.9k
Nov ’22
Can I use an old Mac machine to develop new iOS app?
Hi! I have an old mid-2011 iMac, such that I cannot install the new version of software on it (OS X & XCode). The newest OS X (Mojave) only support iMac 2012 or after, such that I can only use OS High Sierra now, with XCode 10.x. When I created an iOS project with XCode, the displayed "Deployment Target" is only up to 12.1. Does this mean the app I created only work for iOS 12, but not iOS 13?In this situation, if I want to develop iOS 13 app, is it necessary for me to get another Mac machine?Thank you!
2
0
6.3k
Feb ’22
How to embed List in ScrollView using SwiftUI
Hi! I want to allow user to scroll a long list of items iOS app, so I am trying to embbed a List view in ScrollView view. However, the preview result doesn't work. Can you help me to check what I am missing?Below is my experimental code I entered to the file ContentView.swift, started with Single Page App project.struct ContentView: View { var body: some View { ScrollView{ List{ Text("abc") Text("def") } .border(Color.yellow, width: 3) .background(Color.blue) }.padding(10).border(Color.red, width: 3) } }The preview of this code shows the red borders of the ScrollView, but not showing anything for the list, nor the text inside. If I change "List" to "VStack", then everything worked as expected.I don't understand why List doesn't work, and don't know how to fix it. Can you help me to find some clue?Thank you!
6
1
24k
Dec ’21
SwiftUI equivalent to viewWillTransition event in UIKit?
Hi! In an app implemented using SwiftUI, I want to execute some code when a view changes size. In the previous framework (UIKit), this can be done by using viewWillTransition event in UIViewController, but I cannot find a SwiftUI equivalent now. Do you have an idea how to do that?More detail of the issue I encountered:I am following the ADMOB documentation to include adaptive banner ad in the app, and the ADMOB instruction uses the viewWillTransition eventhttps://developers.google.com/admob/ios/banner/adaptiveI has successfully included a banner app using UIViewRepresentable to wrap the ADMOB object that originally supports UIKit, but just missing the way to respond to layout change of the app (more specifically, rotation).Thank you!
Replies
2
Boosts
0
Views
2.9k
Activity
Nov ’22
Can I use an old Mac machine to develop new iOS app?
Hi! I have an old mid-2011 iMac, such that I cannot install the new version of software on it (OS X & XCode). The newest OS X (Mojave) only support iMac 2012 or after, such that I can only use OS High Sierra now, with XCode 10.x. When I created an iOS project with XCode, the displayed "Deployment Target" is only up to 12.1. Does this mean the app I created only work for iOS 12, but not iOS 13?In this situation, if I want to develop iOS 13 app, is it necessary for me to get another Mac machine?Thank you!
Replies
2
Boosts
0
Views
6.3k
Activity
Feb ’22
How to embed List in ScrollView using SwiftUI
Hi! I want to allow user to scroll a long list of items iOS app, so I am trying to embbed a List view in ScrollView view. However, the preview result doesn't work. Can you help me to check what I am missing?Below is my experimental code I entered to the file ContentView.swift, started with Single Page App project.struct ContentView: View { var body: some View { ScrollView{ List{ Text("abc") Text("def") } .border(Color.yellow, width: 3) .background(Color.blue) }.padding(10).border(Color.red, width: 3) } }The preview of this code shows the red borders of the ScrollView, but not showing anything for the list, nor the text inside. If I change "List" to "VStack", then everything worked as expected.I don't understand why List doesn't work, and don't know how to fix it. Can you help me to find some clue?Thank you!
Replies
6
Boosts
1
Views
24k
Activity
Dec ’21