From 651cc1228b7a8ecefa17f457c8140f18c184d9d2 Mon Sep 17 00:00:00 2001 From: W1W1-M Date: Mon, 6 Dec 2021 20:46:50 +0100 Subject: [PATCH] Update readme. Update documentation. Fix localization. --- README.md | 12 +++++------- .../Documentation.docc/Documentation.md | 16 ++++++++++++++++ Sources/PackAPrefPane/Views/PackAPrefPane.swift | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 64c71f7..454c9c3 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,16 @@ ## Usage * Import `PackAPrefPane` Swift package -* Setup a var with `PrefPaneData` type and customize each variable to your needs +* Setup a `PrefPaneData` typed var and customize it to your needs * Setup your nested `appSettingsView` within a SwiftUI `Section` view -* Make sure you have a var for showing sheets `settingsSheetPresented: Bool` -* Use `PackAPrefPane` view with the above variables as in this example: +* Make sure you have a @State var for showing sheets `settingsSheetPresented: Bool` +* Use `PackAPrefPane` view as in the following example: ``` PackAPrefPane( - settingsSheetPresented: yourSheetbool, + settingsSheetPresented: $yourSheetBool, prefPaneData: yourPrefPaneData ) { - Section(header: Text("Your nested app settings view section")) { - YourNestedAppSettingsView() - } + YourNestedAppSettingsSectionView() } ``` diff --git a/Sources/PackAPrefPane/Documentation.docc/Documentation.md b/Sources/PackAPrefPane/Documentation.docc/Documentation.md index 47b98f8..bc0ea71 100644 --- a/Sources/PackAPrefPane/Documentation.docc/Documentation.md +++ b/Sources/PackAPrefPane/Documentation.docc/Documentation.md @@ -10,6 +10,22 @@ PackAPrefPane lets developers quickly implement a settings sheet for their apps. ![PackAPrefPane preview](PackAPrefPanePreview.png) +## Usage + +* Import ``PackAPrefPane/PackAPrefPane`` Swift package +* Setup a ``PrefPaneData`` typed var and customize it to your needs +* Setup your nested `appSettingsView` within a SwiftUI `Section` view +* Make sure you have a @State var for showing sheets `settingsSheetPresented: Bool` +* Use ``PackAPrefPane/PackAPrefPane`` view as in the following example: +``` +PackAPrefPane( + settingsSheetPresented: $yourSheetBool, + prefPaneData: yourPrefPaneData +) { + YourNestedAppSettingsSectionView() +} +``` + ## Topics ### Essentials diff --git a/Sources/PackAPrefPane/Views/PackAPrefPane.swift b/Sources/PackAPrefPane/Views/PackAPrefPane.swift index 1be616b..e173a83 100644 --- a/Sources/PackAPrefPane/Views/PackAPrefPane.swift +++ b/Sources/PackAPrefPane/Views/PackAPrefPane.swift @@ -46,7 +46,7 @@ public struct PackAPrefPane: View { if prefPaneData.legalSectionData.showLegalSection { Legal(legalSectionData: prefPaneData.legalSectionData) } - }.navigationTitle(NSLocalizedString(prefPaneData.prefPaneTitle, tableName: "Localizable", bundle: .module, value: "", comment: "")) + }.navigationTitle(NSLocalizedString(prefPaneData.prefPaneTitle, tableName: "Localizable", bundle: .main, value: "", comment: "")) .toolbar { // Toolbar with close button ToolbarItem(placement: .navigation) { Button(action: {