< How to present a full screen modal view using fullScreenCover() | How to show a menu when a button is pressed > |
Updated for Xcode 12.0
New in iOS 14
SwiftUI gives us a dedicated modifier that can recommend other apps on the App Store, which is a great way to cross-sell to users – “if you liked this, you’ll also like that”, and so on.
This modifier needs some state to watch that will determine whether the App Store overlay is active or not, along with an SKOverlay.AppConfiguration
that determines which app to recommend.
For example, this will recommend a particular app when the button is pressed:
struct ContentView: View {
@State private var showRecommended = false
var body: some View {
Button("Show Recommended App") {
self.showRecommended.toggle()
}
.appStoreOverlay(isPresented: $showRecommended) {
SKOverlay.AppConfiguration(appIdentifier: "1440611372", position: .bottom)
}
}
}
SPONSORED Would you describe yourself as knowledgeable, but struggling when you have to come up with your own code? Fernando Olivares has a new book containing iOS rules you can immediately apply to your coding habits to see dramatic improvements, while also teaching applied programming fundamentals seen in refactored code from published apps.
Sponsor Hacking with Swift and reach the world's largest Swift community!
Link copied to your pasteboard.