This package is a simple way of adding What's New pages to your app. The pages are dynamically created based on the number of items passed to the WhatsNewView.
This framework supports iOS, iPadOS, tvOS (15.0 and above) and macOS (12.0 and above).
-
In your target's General Settings, make sure your app Display Name is set as you want it.
-
Create the content for each What's New page you want displayed. You can use What's New
BulletPointView
struct to add bullet points with images, bold titles and explanatory text (or any other view). The component will use whatever accent color you set for the page.
struct WhatsNewPageView: View {
var body: some View {
VStack (alignment: .leading, spacing: 10){
BulletPointView(title: "We now have SEARCH!!!",
systemName: "paintbrush.fill") {
Text("Search to find books that have been on previous best seller lists.")
}
BulletPointView(title: "More bugs squashed.",
imageName: "myTruck") {
Text("And the hits keep coming")
}
Spacer()
}
.padding()
.accentColor(Color.red)
}
}
... same for each additional page
-
Import WhatsNew into your startup file.
-
In your
@main
struct, create a state variable to control display of WhatsNew pages. -
Instantiate a
WhatsNew
class. You can use the(alwaysShow: true)
parameter to always display WhatsNew content for testing. -
Add the
.onAppear
modifier to check for updates in the version number of the app. Add the.sheet
modifier to yourContentView()
call to display the What's New compomnent.
import SwiftUI
import WhatsNew
@main
struct PackageTesterApp: App {
let whatsNew = WhatsNew(alwaysShow: true)
@State private var showWhatsNew = false
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
whatsNew.checkForUpdate(showWhatsNew: $showWhatsNew)
}
.sheet(isPresented: $showWhatsNew) {
WhatsNewView {
WhatsNewPageView()
WhatsNewPageView2()
}
}
}
}
}
And that should do it!