From 275ec4cd2076050e7a72b7034555102721a182be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Schr=C3=B6der?= Date: Tue, 26 Apr 2022 16:45:44 +0200 Subject: [PATCH 1/2] Fix typo in method signature Mark old method as depricated --- Sources/Extensions/View+WhatsNewSheet.swift | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Sources/Extensions/View+WhatsNewSheet.swift b/Sources/Extensions/View+WhatsNewSheet.swift index 0bb687f..aa277aa 100644 --- a/Sources/Extensions/View+WhatsNewSheet.swift +++ b/Sources/Extensions/View+WhatsNewSheet.swift @@ -10,18 +10,34 @@ public extension View { /// - versionStore: The optional WhatsNewVersionStore. Default value `nil` /// - layout: The WhatsNew Layout. Default value `.default` /// - onDimiss: The closure to execute when dismissing the sheet. Default value `nil` + @available(*, deprecated, renamed: "sheet(whatsNew:versionStore:layout:onDismiss:)") func sheet( whatsNew: Binding, versionStore: WhatsNewVersionStore? = nil, layout: WhatsNew.Layout = .default, - onDimiss: (() -> Void)? = nil + onDimiss: (() -> Void)? + ) -> some View { + self.sheet(whatsNew: whatsNew, versionStore: versionStore, layout: layout, onDismiss: onDimiss) + } + + /// Presents a WhatsNewView using the given WhatsNew object as a data source for the sheet’s content. + /// - Parameters: + /// - whatsNew: A Binding to an optional WhatsNew object + /// - versionStore: The optional WhatsNewVersionStore. Default value `nil` + /// - layout: The WhatsNew Layout. Default value `.default` + /// - onDismiss: The closure to execute when dismissing the sheet. Default value `nil` + func sheet( + whatsNew: Binding, + versionStore: WhatsNewVersionStore? = nil, + layout: WhatsNew.Layout = .default, + onDismiss: (() -> Void)? = nil ) -> some View { self.modifier( ManualWhatsNewSheetViewModifier( whatsNew: whatsNew, versionStore: versionStore, layout: layout, - onDismiss: onDimiss + onDismiss: onDismiss ) ) } From 2a9322a81c86cf05aef4177242b7af4aeb23d135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Schr=C3=B6der?= Date: Tue, 26 Apr 2022 16:46:02 +0200 Subject: [PATCH 2/2] Fix typos --- README.md | 4 ++-- Sources/Extensions/View+WhatsNewSheet.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b32aea2..855f364 100644 --- a/README.md +++ b/README.md @@ -307,7 +307,7 @@ let whatsnew = WhatsNew( backgroundColor: .accentColor, foregroundColor: .white, hapticFeedback: .notification(.success), - onDimiss: { + onDismiss: { print("WhatsNewView has been dismissed") } ), @@ -347,7 +347,7 @@ let version: WhatsNew.Version = .current() A `WhatsNew.Title` represents the title text that is rendered above the features. ```swift -// Initialize by string literla +// Initialize by string literal let title: WhatsNew.Title = "Continue" // Initialize with text and foreground color diff --git a/Sources/Extensions/View+WhatsNewSheet.swift b/Sources/Extensions/View+WhatsNewSheet.swift index aa277aa..f1440c8 100644 --- a/Sources/Extensions/View+WhatsNewSheet.swift +++ b/Sources/Extensions/View+WhatsNewSheet.swift @@ -104,7 +104,7 @@ public extension View { /// Auto-Presents a WhatsNewView to the user if needed based on the `WhatsNewEnvironment` /// - Parameters: /// - layout: The optional custom WhatsNew Layout. Default value `nil` - /// - onDimiss: The closure to execute when dismissing the sheet. Default value `nil` + /// - onDismiss: The closure to execute when dismissing the sheet. Default value `nil` func whatsNewSheet( layout: WhatsNew.Layout? = nil, onDismiss: (() -> Void)? = nil