SwiftUI Support
JulesMoorhouse opened this issue · 2 comments
JulesMoorhouse commented
Hey,
I've used SwiftRater in other older apps in the past, Objective C apps, I've found it works really well.
I'd really like to use this with SwiftUI now.
Jules.
markgravity commented
@JulesMoorhouse you can easily do it in SwiftUI with something like this
@main
struct SwiftRateDemoApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
SwiftRater.daysUntilPrompt = 7
SwiftRater.usesUntilPrompt = 10
SwiftRater.significantUsesUntilPrompt = 3
SwiftRater.daysBeforeReminding = 1
SwiftRater.showLaterButton = true
SwiftRater.debugMode = true
SwiftRater.appLaunched()
return true
}
}
More info about UIApplicationDelegateAdaptor
here