Closed john-work-ios closed 2 years ago
Hi @john-work-ios,
This kind of question is better placed on platform like StackOverflow in order to get help from the community to implement some kind of special tailored logic.
In general you are free to present a WhatsNewViewController
in any kind of way you prefer.
Additionally, you can make use of the WhatsNewVersionStore
protocol to add a custom validation logic that is used by a WhatsNewViewController
when the store gets injected via the initializer parameter.
https://github.com/SvenTiigi/WhatsNewKit#whatsnewversionstore-
Hi @SvenTiigi ,
thank you for the kind reply. I totally agree with you. However, I think (but I might be wrong of course) this was a very common use case for this framework, and that it could already be included. (In other words, that I might have missed something reading the documentation). Based on your answer, I was wrong. Thanks for taking the time to answer, and thanks again for the great work on this framework.
Hi @john-work-ios
WhatsNewKit has been updated to a new major version 2.0.0
with extended support for SwiftUI, UIKit and AppKit.
The new version includes some major breaking changes but also a new WhatsNewEnvironment
API which you can make use of when using SwiftUI to automatically present a matching WhatsNew object to the user.
The WhatsNewEnvironment now includes a fallback for patch versions. For example when a user installs version 1.0.1
and you only have declared a WhatsNew for version 1.0.0
the environment will automatically fallback to version 1.0.0
and present the WhatsNewView to the user if needed.
If you wish to further customize the behaviour of the WhatsNewEnvironment
you can easily subclass it and override the whatsNew()
function.
class MyCustomWhatsNewEnvironment: WhatsNewEnvironment {
/// Retrieve a WhatsNew that should be presented to the user, if available.
override func whatsNew() -> WhatsNew? {
// The current version
let currentVersion = self.currentVersion
// Your declared WhatsNew objects
let whatsNewCollection = self.whatsNewCollection
// The WhatsNewVersionStore used to determine the already presented versions
let versionStore = self.whatsNewVersionStore
// TODO: Determine WhatsNew that should be presented to the user...
}
}
Hello,
Thanks for this beautiful kit. I'm trying to figure out how to elegantly:
Any easy way to do that?
Thanks!