From 07258305825456e446fc6dc11af0f31cddc26344 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 18:38:28 +0300 Subject: [PATCH 01/21] add about view --- TestApp/Sources/About/AboutView.swift | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 TestApp/Sources/About/AboutView.swift diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift new file mode 100644 index 000000000..e49b14721 --- /dev/null +++ b/TestApp/Sources/About/AboutView.swift @@ -0,0 +1,40 @@ +// +// Copyright 2024 Readium Foundation. All rights reserved. +// Use of this source code is governed by the BSD-style license +// available in the top-level LICENSE file of the project. +// + +import SwiftUI + +struct AboutView: View { + var body: some View { + VStack(alignment: .leading, spacing: 20) { + Text("Version") + .font(.title2) + HStack(spacing: 10) { + Text("Version").frame(width: 170.0, alignment: .leading) + Text("2.3.0") + } + HStack(spacing: 10) { + Text("Build").frame(width: 170.0, alignment: .leading) + Text("1") + } + Text("Copyright").font(.title2) + Link("© 2022 European Digital Reading Lab", + destination: URL(string: "https://www.edrlab.org/")!) + Link("[BSD-3 License]", + destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) + Text("Acknowledgements").font(.title2) + Text("R2 Reader wouldn't have been developed without the financial help of the French State.") + Image("rf") + } + .padding() + .navigationTitle("About") + } +} + +struct About_Previews: PreviewProvider { + static var previews: some View { + AboutView() + } +} From 731b6e9cc8cf2873d84acf2e48db8fe6ec0500a6 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 18:49:41 +0300 Subject: [PATCH 02/21] add data from bundle --- TestApp/Sources/About/AboutView.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index e49b14721..5756a8dae 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -13,11 +13,11 @@ struct AboutView: View { .font(.title2) HStack(spacing: 10) { Text("Version").frame(width: 170.0, alignment: .leading) - Text("2.3.0") + Text(.appVersion ?? "") } HStack(spacing: 10) { Text("Build").frame(width: 170.0, alignment: .leading) - Text("1") + Text(.buildVersion ?? "") } Text("Copyright").font(.title2) Link("© 2022 European Digital Reading Lab", @@ -38,3 +38,9 @@ struct About_Previews: PreviewProvider { AboutView() } } + +private extension String { + static let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String + + static let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String +} From 29d23db1a2516221cc5f54a4c73b16b8765c1363 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 18:52:31 +0300 Subject: [PATCH 03/21] ui fixes --- TestApp/Sources/About/AboutView.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 5756a8dae..54aa0604f 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -12,11 +12,13 @@ struct AboutView: View { Text("Version") .font(.title2) HStack(spacing: 10) { - Text("Version").frame(width: 170.0, alignment: .leading) + Text("app_version_caption").frame(width: 170.0, alignment: .leading) + Spacer() Text(.appVersion ?? "") } HStack(spacing: 10) { - Text("Build").frame(width: 170.0, alignment: .leading) + Text("build_version_caption").frame(width: 170.0, alignment: .leading) + Spacer() Text(.buildVersion ?? "") } Text("Copyright").font(.title2) @@ -28,7 +30,7 @@ struct AboutView: View { Text("R2 Reader wouldn't have been developed without the financial help of the French State.") Image("rf") } - .padding() + .padding(.horizontal, 16) .navigationTitle("About") } } From 5461daf9f5f05bfd3aba1a064082768c530e6646 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 19:00:34 +0300 Subject: [PATCH 04/21] setup for debug --- TestApp/Sources/AppDelegate.swift | 64 +++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/TestApp/Sources/AppDelegate.swift b/TestApp/Sources/AppDelegate.swift index 975e5e350..6fa4ce8ac 100644 --- a/TestApp/Sources/AppDelegate.swift +++ b/TestApp/Sources/AppDelegate.swift @@ -16,38 +16,38 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private var subscriptions = Set() func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - app = try! AppModule() - - func makeItem(title: String, image: String) -> UITabBarItem { - UITabBarItem( - title: NSLocalizedString(title, comment: "Library tab title"), - image: UIImage(named: image), - tag: 0 - ) - } - - // Library - let libraryViewController = app.library.rootViewController - libraryViewController.tabBarItem = makeItem(title: "bookshelf_tab", image: "bookshelf") - - // OPDS Feeds - let opdsViewController = app.opds.rootViewController - opdsViewController.tabBarItem = makeItem(title: "catalogs_tab", image: "catalogs") - - // About - let aboutViewController = app.aboutViewController - aboutViewController.tabBarItem = makeItem(title: "about_tab", image: "about") - - let tabBarController = UITabBarController() - tabBarController.viewControllers = [ - libraryViewController, - opdsViewController, - aboutViewController, - ] - - window = UIWindow(frame: UIScreen.main.bounds) - window?.rootViewController = tabBarController - window?.makeKeyAndVisible() +// app = try! AppModule() +// +// func makeItem(title: String, image: String) -> UITabBarItem { +// UITabBarItem( +// title: NSLocalizedString(title, comment: "Library tab title"), +// image: UIImage(named: image), +// tag: 0 +// ) +// } +// +// // Library +// let libraryViewController = app.library.rootViewController +// libraryViewController.tabBarItem = makeItem(title: "bookshelf_tab", image: "bookshelf") +// +// // OPDS Feeds +// let opdsViewController = app.opds.rootViewController +// opdsViewController.tabBarItem = makeItem(title: "catalogs_tab", image: "catalogs") +// +// // About +// let aboutViewController = app.aboutViewController +// aboutViewController.tabBarItem = makeItem(title: "about_tab", image: "about") +// +// let tabBarController = UITabBarController() +// tabBarController.viewControllers = [ +// libraryViewController, +// opdsViewController, +// aboutViewController, +// ] +// +// window = UIWindow(frame: UIScreen.main.bounds) +// window?.rootViewController = tabBarController +// window?.makeKeyAndVisible() return true } From 08e96acd29da5526acfeea47c2ee373d17f6848c Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 19:04:49 +0300 Subject: [PATCH 05/21] refactoring --- TestApp/Sources/About/AboutView.swift | 37 ++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 54aa0604f..377ecd334 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -8,30 +8,53 @@ import SwiftUI struct AboutView: View { var body: some View { - VStack(alignment: .leading, spacing: 20) { + VStack(alignment: .center, spacing: 20) { + versionSection + copyrightSection + acknowledgementsSection + } + .padding(.horizontal, 16) + .navigationTitle("About") + } + + private var versionSection: some View { + VStack(alignment: .leading) { Text("Version") .font(.title2) - HStack(spacing: 10) { - Text("app_version_caption").frame(width: 170.0, alignment: .leading) + HStack { + Text("app_version_caption") Spacer() Text(.appVersion ?? "") } + HStack(spacing: 10) { Text("build_version_caption").frame(width: 170.0, alignment: .leading) Spacer() Text(.buildVersion ?? "") } - Text("Copyright").font(.title2) + } + } + + private var copyrightSection: some View { + VStack(alignment: .leading) { + Text("Copyright") + .font(.title2) + .frame(maxWidth: .infinity, alignment: .leading) Link("© 2022 European Digital Reading Lab", destination: URL(string: "https://www.edrlab.org/")!) Link("[BSD-3 License]", destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) - Text("Acknowledgements").font(.title2) + } + } + + private var acknowledgementsSection: some View { + VStack(alignment: .leading) { + Text("Acknowledgements") + .font(.title2) + .frame(maxWidth: .infinity, alignment: .leading) Text("R2 Reader wouldn't have been developed without the financial help of the French State.") Image("rf") } - .padding(.horizontal, 16) - .navigationTitle("About") } } From 75b8cd45e40e2451b706a19ccbd55394ce8e5ce4 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 19:05:12 +0300 Subject: [PATCH 06/21] restore --- TestApp/Sources/AppDelegate.swift | 64 +++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/TestApp/Sources/AppDelegate.swift b/TestApp/Sources/AppDelegate.swift index 6fa4ce8ac..975e5e350 100644 --- a/TestApp/Sources/AppDelegate.swift +++ b/TestApp/Sources/AppDelegate.swift @@ -16,38 +16,38 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private var subscriptions = Set() func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { -// app = try! AppModule() -// -// func makeItem(title: String, image: String) -> UITabBarItem { -// UITabBarItem( -// title: NSLocalizedString(title, comment: "Library tab title"), -// image: UIImage(named: image), -// tag: 0 -// ) -// } -// -// // Library -// let libraryViewController = app.library.rootViewController -// libraryViewController.tabBarItem = makeItem(title: "bookshelf_tab", image: "bookshelf") -// -// // OPDS Feeds -// let opdsViewController = app.opds.rootViewController -// opdsViewController.tabBarItem = makeItem(title: "catalogs_tab", image: "catalogs") -// -// // About -// let aboutViewController = app.aboutViewController -// aboutViewController.tabBarItem = makeItem(title: "about_tab", image: "about") -// -// let tabBarController = UITabBarController() -// tabBarController.viewControllers = [ -// libraryViewController, -// opdsViewController, -// aboutViewController, -// ] -// -// window = UIWindow(frame: UIScreen.main.bounds) -// window?.rootViewController = tabBarController -// window?.makeKeyAndVisible() + app = try! AppModule() + + func makeItem(title: String, image: String) -> UITabBarItem { + UITabBarItem( + title: NSLocalizedString(title, comment: "Library tab title"), + image: UIImage(named: image), + tag: 0 + ) + } + + // Library + let libraryViewController = app.library.rootViewController + libraryViewController.tabBarItem = makeItem(title: "bookshelf_tab", image: "bookshelf") + + // OPDS Feeds + let opdsViewController = app.opds.rootViewController + opdsViewController.tabBarItem = makeItem(title: "catalogs_tab", image: "catalogs") + + // About + let aboutViewController = app.aboutViewController + aboutViewController.tabBarItem = makeItem(title: "about_tab", image: "about") + + let tabBarController = UITabBarController() + tabBarController.viewControllers = [ + libraryViewController, + opdsViewController, + aboutViewController, + ] + + window = UIWindow(frame: UIScreen.main.bounds) + window?.rootViewController = tabBarController + window?.makeKeyAndVisible() return true } From bbb87308d872078860783ca11946ac8b7e8066fd Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 19:17:00 +0300 Subject: [PATCH 07/21] add AboutSectionView --- TestApp/Sources/About/AboutSectionView.swift | 33 +++++++++++++ TestApp/Sources/About/AboutView.swift | 52 ++++++++++---------- 2 files changed, 58 insertions(+), 27 deletions(-) create mode 100644 TestApp/Sources/About/AboutSectionView.swift diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift new file mode 100644 index 000000000..e27438c87 --- /dev/null +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -0,0 +1,33 @@ +// +// Copyright 2024 Readium Foundation. All rights reserved. +// Use of this source code is governed by the BSD-style license +// available in the top-level LICENSE file of the project. +// + +import SwiftUI + +struct AboutSectionView: View { + + private let title: String + private var content: () -> Content + + init( + title: String, + content: @escaping () -> Content + ) { + self.title = title + self.content = content + } + + var body: some View { + VStack(alignment: .leading) { + Text(title) + .font(.title2) + .bold() + .foregroundColor(.secondary) + .frame(maxWidth: .infinity, alignment: .leading) + content() + } + } + +} diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 377ecd334..bab32f13c 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -18,42 +18,40 @@ struct AboutView: View { } private var versionSection: some View { - VStack(alignment: .leading) { - Text("Version") - .font(.title2) - HStack { - Text("app_version_caption") - Spacer() - Text(.appVersion ?? "") - } - - HStack(spacing: 10) { - Text("build_version_caption").frame(width: 170.0, alignment: .leading) - Spacer() - Text(.buildVersion ?? "") + AboutSectionView(title: "Version") { + VStack { + HStack { + Text("app_version_caption") + Spacer() + Text(.appVersion ?? "") + } + + HStack(spacing: 10) { + Text("build_version_caption").frame(width: 170.0, alignment: .leading) + Spacer() + Text(.buildVersion ?? "") + } } } } private var copyrightSection: some View { - VStack(alignment: .leading) { - Text("Copyright") - .font(.title2) - .frame(maxWidth: .infinity, alignment: .leading) - Link("© 2022 European Digital Reading Lab", - destination: URL(string: "https://www.edrlab.org/")!) - Link("[BSD-3 License]", - destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) + AboutSectionView(title: "Copyright") { + VStack(alignment: .leading) { + Link("© 2022 European Digital Reading Lab", + destination: URL(string: "https://www.edrlab.org/")!) + Link("[BSD-3 License]", + destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) + } } } private var acknowledgementsSection: some View { - VStack(alignment: .leading) { - Text("Acknowledgements") - .font(.title2) - .frame(maxWidth: .infinity, alignment: .leading) - Text("R2 Reader wouldn't have been developed without the financial help of the French State.") - Image("rf") + AboutSectionView(title: "Acknowledgements") { + VStack(alignment: .leading) { + Text("R2 Reader wouldn't have been developed without the financial help of the French State.") + Image("rf") + } } } } From 49b2bf8b4632d81e2d618084e28772b55c64c693 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 19:24:02 +0300 Subject: [PATCH 08/21] fix UI --- TestApp/Sources/About/AboutSectionView.swift | 14 ++++++++------ TestApp/Sources/About/AboutView.swift | 8 +++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index e27438c87..999eaff5e 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -20,12 +20,14 @@ struct AboutSectionView: View { } var body: some View { - VStack(alignment: .leading) { - Text(title) - .font(.title2) - .bold() - .foregroundColor(.secondary) - .frame(maxWidth: .infinity, alignment: .leading) + VStack(spacing: 16) { + HStack { + Text(title) + .font(.title2) + .bold() + .foregroundColor(.secondary) + Spacer() + } content() } } diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index bab32f13c..9b822d82c 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -19,7 +19,7 @@ struct AboutView: View { private var versionSection: some View { AboutSectionView(title: "Version") { - VStack { + VStack(spacing: 16) { HStack { Text("app_version_caption") Spacer() @@ -37,19 +37,21 @@ struct AboutView: View { private var copyrightSection: some View { AboutSectionView(title: "Copyright") { - VStack(alignment: .leading) { + VStack(alignment: .leading, spacing: 16) { Link("© 2022 European Digital Reading Lab", destination: URL(string: "https://www.edrlab.org/")!) Link("[BSD-3 License]", destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) } + .frame(maxWidth: .infinity, alignment: .leading) } } private var acknowledgementsSection: some View { AboutSectionView(title: "Acknowledgements") { - VStack(alignment: .leading) { + VStack(alignment: .center, spacing: 16) { Text("R2 Reader wouldn't have been developed without the financial help of the French State.") + .multilineTextAlignment(.center) Image("rf") } } From 2716f157f1460b375412b3f68a58892d70ac5aa4 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 19:47:14 +0300 Subject: [PATCH 09/21] use about view --- TestApp/Sources/About/AboutView.swift | 1 - TestApp/Sources/App/AppModule.swift | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 9b822d82c..b607cacd4 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -14,7 +14,6 @@ struct AboutView: View { acknowledgementsSection } .padding(.horizontal, 16) - .navigationTitle("About") } private var versionSection: some View { diff --git a/TestApp/Sources/App/AppModule.swift b/TestApp/Sources/App/AppModule.swift index 5a6e0401f..260e14ece 100644 --- a/TestApp/Sources/App/AppModule.swift +++ b/TestApp/Sources/App/AppModule.swift @@ -9,6 +9,7 @@ import Foundation import ReadiumShared import ReadiumStreamer import UIKit +import SwiftUI /// Base module delegate, that sub-modules' delegate can extend. /// Provides basic shared functionalities. @@ -58,9 +59,9 @@ final class AppModule { } private(set) lazy var aboutViewController: UIViewController = { - let storyboard = UIStoryboard(name: "App", bundle: nil) - let aboutViewController = storyboard.instantiateViewController(withIdentifier: "AboutTableViewController") as! AboutTableViewController - return UINavigationController(rootViewController: aboutViewController) + let hosting = UIHostingController(rootView: AboutView()) + hosting.navigationItem.title = "About the Readium Swift Toolkit" + return UINavigationController(rootViewController: hosting) }() } @@ -88,7 +89,11 @@ extension AppModule: LibraryModuleDelegate { extension AppModule: ReaderModuleDelegate {} extension AppModule: OPDSModuleDelegate { - func opdsDownloadPublication(_ publication: Publication?, at link: Link, sender: UIViewController) async throws -> Book { + func opdsDownloadPublication( + _ publication: Publication?, + at link: ReadiumShared.Link, + sender: UIViewController + ) async throws -> Book { guard let url = link.url(relativeTo: publication?.baseURL).absoluteURL else { throw OPDSError.invalidURL(link.href) } From e4f0e6852e38468df022e74206d6d50e240aaf15 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 20:35:44 +0300 Subject: [PATCH 10/21] use NavigationView --- TestApp/Sources/About/AboutView.swift | 14 +++++++++----- TestApp/Sources/App/AppModule.swift | 6 +----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index b607cacd4..1645eb77f 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -8,12 +8,16 @@ import SwiftUI struct AboutView: View { var body: some View { - VStack(alignment: .center, spacing: 20) { - versionSection - copyrightSection - acknowledgementsSection + NavigationView { + VStack(alignment: .center, spacing: 20) { + versionSection + copyrightSection + acknowledgementsSection + } + .padding(.horizontal, 16) + .navigationBarTitleDisplayMode(.inline) + .navigationTitle("About the Readium Swift Toolkit") } - .padding(.horizontal, 16) } private var versionSection: some View { diff --git a/TestApp/Sources/App/AppModule.swift b/TestApp/Sources/App/AppModule.swift index 260e14ece..4eeeb8186 100644 --- a/TestApp/Sources/App/AppModule.swift +++ b/TestApp/Sources/App/AppModule.swift @@ -58,11 +58,7 @@ final class AppModule { ReadiumEnableLog(withMinimumSeverityLevel: .warning) } - private(set) lazy var aboutViewController: UIViewController = { - let hosting = UIHostingController(rootView: AboutView()) - hosting.navigationItem.title = "About the Readium Swift Toolkit" - return UINavigationController(rootViewController: hosting) - }() + private(set) lazy var aboutViewController = UIHostingController(rootView: AboutView()) } extension AppModule: ModuleDelegate { From 753cb8ca2c7f695b5d9e43b7166f7516880d2121 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 20:50:54 +0300 Subject: [PATCH 11/21] add some color --- TestApp/Sources/About/AboutSectionView.swift | 6 +++++- TestApp/Sources/About/AboutView.swift | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index 999eaff5e..e6c89b463 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -25,11 +25,15 @@ struct AboutSectionView: View { Text(title) .font(.title2) .bold() - .foregroundColor(.secondary) + .foregroundColor(Color(red: 0.0, green: 0.18, blue: 0.39)) Spacer() } content() } + .padding() + .background(Color(UIColor.secondarySystemGroupedBackground)) + .cornerRadius(10) + .shadow(radius: 2) } } diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 1645eb77f..22f2dd2cb 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -7,6 +7,7 @@ import SwiftUI struct AboutView: View { + var body: some View { NavigationView { VStack(alignment: .center, spacing: 20) { @@ -18,21 +19,26 @@ struct AboutView: View { .navigationBarTitleDisplayMode(.inline) .navigationTitle("About the Readium Swift Toolkit") } + .accentColor(Color(red: 0.78, green: 0.0, blue: 0.0)) } private var versionSection: some View { AboutSectionView(title: "Version") { VStack(spacing: 16) { HStack { - Text("app_version_caption") + Text("App Version:") + .foregroundColor(.gray) Spacer() Text(.appVersion ?? "") + .foregroundColor(.primary) } HStack(spacing: 10) { - Text("build_version_caption").frame(width: 170.0, alignment: .leading) + Text("Build Version:") + .foregroundColor(.gray) Spacer() Text(.buildVersion ?? "") + .foregroundColor(.primary) } } } @@ -43,8 +49,10 @@ struct AboutView: View { VStack(alignment: .leading, spacing: 16) { Link("© 2022 European Digital Reading Lab", destination: URL(string: "https://www.edrlab.org/")!) + .foregroundColor(Color(red: 0.78, green: 0.0, blue: 0.0)) Link("[BSD-3 License]", destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) + .foregroundColor(Color(red: 0.78, green: 0.0, blue: 0.0)) } .frame(maxWidth: .infinity, alignment: .leading) } @@ -55,7 +63,12 @@ struct AboutView: View { VStack(alignment: .center, spacing: 16) { Text("R2 Reader wouldn't have been developed without the financial help of the French State.") .multilineTextAlignment(.center) + .foregroundColor(.primary) Image("rf") + .resizable() + .scaledToFit() + .frame(width: 150) + .clipShape(RoundedRectangle(cornerRadius: 10)) } } } From fcdcd1059f9df1c1bc96a849b899d5aab71d09e9 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 20:51:49 +0300 Subject: [PATCH 12/21] fix color --- TestApp/Sources/About/AboutView.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 22f2dd2cb..4b1dce1fe 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -19,7 +19,6 @@ struct AboutView: View { .navigationBarTitleDisplayMode(.inline) .navigationTitle("About the Readium Swift Toolkit") } - .accentColor(Color(red: 0.78, green: 0.0, blue: 0.0)) } private var versionSection: some View { @@ -49,10 +48,8 @@ struct AboutView: View { VStack(alignment: .leading, spacing: 16) { Link("© 2022 European Digital Reading Lab", destination: URL(string: "https://www.edrlab.org/")!) - .foregroundColor(Color(red: 0.78, green: 0.0, blue: 0.0)) Link("[BSD-3 License]", destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) - .foregroundColor(Color(red: 0.78, green: 0.0, blue: 0.0)) } .frame(maxWidth: .infinity, alignment: .leading) } From 71559846a20deb48bc41b2f26c75de88fbf4ef10 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 20:56:21 +0300 Subject: [PATCH 13/21] fixes for small screen --- TestApp/Sources/About/AboutView.swift | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 4b1dce1fe..80cf56261 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -10,12 +10,14 @@ struct AboutView: View { var body: some View { NavigationView { - VStack(alignment: .center, spacing: 20) { - versionSection - copyrightSection - acknowledgementsSection + ScrollView(showsIndicators: false) { + VStack(alignment: .center, spacing: 20) { + versionSection + copyrightSection + acknowledgementsSection + } + .padding(.horizontal, 16) } - .padding(.horizontal, 16) .navigationBarTitleDisplayMode(.inline) .navigationTitle("About the Readium Swift Toolkit") } @@ -46,10 +48,15 @@ struct AboutView: View { private var copyrightSection: some View { AboutSectionView(title: "Copyright") { VStack(alignment: .leading, spacing: 16) { - Link("© 2022 European Digital Reading Lab", - destination: URL(string: "https://www.edrlab.org/")!) - Link("[BSD-3 License]", - destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) + Link(destination: URL(string: "https://www.edrlab.org/")!) { + Text("© 2022 European Digital Reading Lab") + .multilineTextAlignment(.leading) + } + + Link(destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) { + Text("[BSD-3 License]") + .multilineTextAlignment(.leading) + } } .frame(maxWidth: .infinity, alignment: .leading) } From 155bfeff2610987581898481df849fee39d24c02 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 20:58:11 +0300 Subject: [PATCH 14/21] refactoring --- TestApp/Sources/About/AboutView.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 80cf56261..e3adc2a49 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -48,12 +48,12 @@ struct AboutView: View { private var copyrightSection: some View { AboutSectionView(title: "Copyright") { VStack(alignment: .leading, spacing: 16) { - Link(destination: URL(string: "https://www.edrlab.org/")!) { + Link(destination: .edrlab) { Text("© 2022 European Digital Reading Lab") .multilineTextAlignment(.leading) } - Link(destination: URL(string: "https://opensource.org/licenses/BSD-3-Clause")!) { + Link(destination: .license) { Text("[BSD-3 License]") .multilineTextAlignment(.leading) } @@ -89,3 +89,8 @@ private extension String { static let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String } + +private extension URL { + static let edrlab = URL(string: "https://www.edrlab.org/")! + static let license = URL(string: "https://opensource.org/licenses/BSD-3-Clause")! +} From 4c0be2703dc9ac42f9c8438f6ff550ff2614ab67 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Mon, 14 Oct 2024 20:59:23 +0300 Subject: [PATCH 15/21] swiftformat fixes --- TestApp/Sources/About/AboutSectionView.swift | 6 ++---- TestApp/Sources/About/AboutView.swift | 13 ++++++------- TestApp/Sources/App/AppModule.swift | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index e6c89b463..e821dcba6 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -7,10 +7,9 @@ import SwiftUI struct AboutSectionView: View { - private let title: String private var content: () -> Content - + init( title: String, content: @escaping () -> Content @@ -18,7 +17,7 @@ struct AboutSectionView: View { self.title = title self.content = content } - + var body: some View { VStack(spacing: 16) { HStack { @@ -35,5 +34,4 @@ struct AboutSectionView: View { .cornerRadius(10) .shadow(radius: 2) } - } diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index e3adc2a49..78f0a68a0 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -7,7 +7,6 @@ import SwiftUI struct AboutView: View { - var body: some View { NavigationView { ScrollView(showsIndicators: false) { @@ -22,7 +21,7 @@ struct AboutView: View { .navigationTitle("About the Readium Swift Toolkit") } } - + private var versionSection: some View { AboutSectionView(title: "Version") { VStack(spacing: 16) { @@ -33,7 +32,7 @@ struct AboutView: View { Text(.appVersion ?? "") .foregroundColor(.primary) } - + HStack(spacing: 10) { Text("Build Version:") .foregroundColor(.gray) @@ -44,7 +43,7 @@ struct AboutView: View { } } } - + private var copyrightSection: some View { AboutSectionView(title: "Copyright") { VStack(alignment: .leading, spacing: 16) { @@ -52,7 +51,7 @@ struct AboutView: View { Text("© 2022 European Digital Reading Lab") .multilineTextAlignment(.leading) } - + Link(destination: .license) { Text("[BSD-3 License]") .multilineTextAlignment(.leading) @@ -61,7 +60,7 @@ struct AboutView: View { .frame(maxWidth: .infinity, alignment: .leading) } } - + private var acknowledgementsSection: some View { AboutSectionView(title: "Acknowledgements") { VStack(alignment: .center, spacing: 16) { @@ -86,7 +85,7 @@ struct About_Previews: PreviewProvider { private extension String { static let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - + static let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String } diff --git a/TestApp/Sources/App/AppModule.swift b/TestApp/Sources/App/AppModule.swift index 4eeeb8186..d6b6cf01c 100644 --- a/TestApp/Sources/App/AppModule.swift +++ b/TestApp/Sources/App/AppModule.swift @@ -8,8 +8,8 @@ import Combine import Foundation import ReadiumShared import ReadiumStreamer -import UIKit import SwiftUI +import UIKit /// Base module delegate, that sub-modules' delegate can extend. /// Provides basic shared functionalities. From d57f83ead0abe333e90d4f7fb0260c9af86f9a51 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Tue, 15 Oct 2024 03:44:21 +0300 Subject: [PATCH 16/21] add icons --- TestApp/Sources/About/AboutSectionView.swift | 20 ++++++++++++++------ TestApp/Sources/About/AboutView.swift | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index e821dcba6..36c60e026 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -8,23 +8,31 @@ import SwiftUI struct AboutSectionView: View { private let title: String + private let iconName: String private var content: () -> Content - + init( title: String, + iconName: String, content: @escaping () -> Content ) { self.title = title + self.iconName = iconName self.content = content } - + var body: some View { VStack(spacing: 16) { HStack { - Text(title) - .font(.title2) - .bold() - .foregroundColor(Color(red: 0.0, green: 0.18, blue: 0.39)) + Label { + Text(title) + .bold() + } icon: { + Image(systemName: iconName) + } + .font(.title2) + .foregroundColor(Color(red: 0.0, green: 0.18, blue: 0.39)) + Spacer() } content() diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 78f0a68a0..ee58dcb79 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -23,7 +23,10 @@ struct AboutView: View { } private var versionSection: some View { - AboutSectionView(title: "Version") { + AboutSectionView( + title: "Version", + iconName: "app.badge" + ) { VStack(spacing: 16) { HStack { Text("App Version:") @@ -45,7 +48,10 @@ struct AboutView: View { } private var copyrightSection: some View { - AboutSectionView(title: "Copyright") { + AboutSectionView( + title: "Copyright", + iconName: "c.circle" + ) { VStack(alignment: .leading, spacing: 16) { Link(destination: .edrlab) { Text("© 2022 European Digital Reading Lab") @@ -62,7 +68,10 @@ struct AboutView: View { } private var acknowledgementsSection: some View { - AboutSectionView(title: "Acknowledgements") { + AboutSectionView( + title: "Acknowledgements", + iconName: "hands.sparkles" + ) { VStack(alignment: .center, spacing: 16) { Text("R2 Reader wouldn't have been developed without the financial help of the French State.") .multilineTextAlignment(.center) From 5170ef227b70475a4b39c8b2cd6d513c7db08b2c Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Tue, 15 Oct 2024 03:44:45 +0300 Subject: [PATCH 17/21] swift format fixes --- TestApp/Sources/About/AboutSectionView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index 36c60e026..41e0e582f 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -10,7 +10,7 @@ struct AboutSectionView: View { private let title: String private let iconName: String private var content: () -> Content - + init( title: String, iconName: String, @@ -20,7 +20,7 @@ struct AboutSectionView: View { self.iconName = iconName self.content = content } - + var body: some View { VStack(spacing: 16) { HStack { @@ -32,7 +32,7 @@ struct AboutSectionView: View { } .font(.title2) .foregroundColor(Color(red: 0.0, green: 0.18, blue: 0.39)) - + Spacer() } content() From d716832799c6f6ae8ffe0bb76252547a83af7456 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Thu, 17 Oct 2024 15:43:17 +0300 Subject: [PATCH 18/21] fix style --- TestApp/Sources/About/AboutSectionView.swift | 54 +++++++++++++------- TestApp/Sources/About/AboutView.swift | 12 ++--- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index 41e0e582f..7c992c248 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -10,7 +10,7 @@ struct AboutSectionView: View { private let title: String private let iconName: String private var content: () -> Content - + init( title: String, iconName: String, @@ -20,26 +20,44 @@ struct AboutSectionView: View { self.iconName = iconName self.content = content } - + var body: some View { - VStack(spacing: 16) { - HStack { - Label { - Text(title) - .bold() - } icon: { - Image(systemName: iconName) - } - .font(.title2) - .foregroundColor(Color(red: 0.0, green: 0.18, blue: 0.39)) + GroupBox { + content() + .padding(.top, 4) + } label: { + Label { + Text(title) + .bold() + } icon: { + Image(systemName: iconName) + } + .font(.title2) + } + } +} - Spacer() +#Preview { + AboutSectionView( + title: "Version", + iconName: "app.badge") { + VStack { + HStack { + Text("App Version:") + .foregroundColor(.gray) + Spacer() + Text("alpha-3.0") + .foregroundColor(.primary) + } + + HStack(spacing: 10) { + Text("Build Version:") + .foregroundColor(.gray) + Spacer() + Text("alpha-3.0") + .foregroundColor(.primary) + } } - content() } .padding() - .background(Color(UIColor.secondarySystemGroupedBackground)) - .cornerRadius(10) - .shadow(radius: 2) - } } diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index ee58dcb79..7776bd90e 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -27,10 +27,10 @@ struct AboutView: View { title: "Version", iconName: "app.badge" ) { - VStack(spacing: 16) { + VStack { HStack { Text("App Version:") - .foregroundColor(.gray) + .foregroundColor(.secondary) Spacer() Text(.appVersion ?? "") .foregroundColor(.primary) @@ -38,7 +38,7 @@ struct AboutView: View { HStack(spacing: 10) { Text("Build Version:") - .foregroundColor(.gray) + .foregroundColor(.secondary) Spacer() Text(.buildVersion ?? "") .foregroundColor(.primary) @@ -52,7 +52,7 @@ struct AboutView: View { title: "Copyright", iconName: "c.circle" ) { - VStack(alignment: .leading, spacing: 16) { + VStack(alignment: .leading) { Link(destination: .edrlab) { Text("© 2022 European Digital Reading Lab") .multilineTextAlignment(.leading) @@ -72,14 +72,14 @@ struct AboutView: View { title: "Acknowledgements", iconName: "hands.sparkles" ) { - VStack(alignment: .center, spacing: 16) { + VStack(alignment: .center) { Text("R2 Reader wouldn't have been developed without the financial help of the French State.") .multilineTextAlignment(.center) .foregroundColor(.primary) Image("rf") .resizable() .scaledToFit() - .frame(width: 150) + .frame(width: 200) .clipShape(RoundedRectangle(cornerRadius: 10)) } } From aa97bffe6fb32e968461f0548556030a36571d2f Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Thu, 17 Oct 2024 15:46:01 +0300 Subject: [PATCH 19/21] add icon --- TestApp/Sources/About/AboutSectionView.swift | 19 ++++++++++++------- TestApp/Sources/About/AboutView.swift | 6 +++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index 7c992c248..b5baa5eca 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -7,17 +7,24 @@ import SwiftUI struct AboutSectionView: View { + + enum Icon: String { + case app = "app.badge" + case circle = "c.circle" + case hands = "hands.sparkles" + } + private let title: String - private let iconName: String + private let icon: Icon private var content: () -> Content init( title: String, - iconName: String, + icon: Icon, content: @escaping () -> Content ) { self.title = title - self.iconName = iconName + self.icon = icon self.content = content } @@ -30,7 +37,7 @@ struct AboutSectionView: View { Text(title) .bold() } icon: { - Image(systemName: iconName) + Image(systemName: icon.rawValue) } .font(.title2) } @@ -38,9 +45,7 @@ struct AboutSectionView: View { } #Preview { - AboutSectionView( - title: "Version", - iconName: "app.badge") { + AboutSectionView(title: "Version", icon: .app) { VStack { HStack { Text("App Version:") diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 7776bd90e..7cb480102 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -25,7 +25,7 @@ struct AboutView: View { private var versionSection: some View { AboutSectionView( title: "Version", - iconName: "app.badge" + icon: .app ) { VStack { HStack { @@ -50,7 +50,7 @@ struct AboutView: View { private var copyrightSection: some View { AboutSectionView( title: "Copyright", - iconName: "c.circle" + icon: .circle ) { VStack(alignment: .leading) { Link(destination: .edrlab) { @@ -70,7 +70,7 @@ struct AboutView: View { private var acknowledgementsSection: some View { AboutSectionView( title: "Acknowledgements", - iconName: "hands.sparkles" + icon: .hands ) { VStack(alignment: .center) { Text("R2 Reader wouldn't have been developed without the financial help of the French State.") From 7b5e42997d42cc1a7908b6780bb23964ea77c153 Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Thu, 17 Oct 2024 17:02:55 +0300 Subject: [PATCH 20/21] fix layout --- TestApp/Sources/About/AboutView.swift | 28 ++++++++++++--------------- TestApp/Sources/App/AppModule.swift | 7 ++++++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 7cb480102..6af0c10ad 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -8,20 +8,16 @@ import SwiftUI struct AboutView: View { var body: some View { - NavigationView { - ScrollView(showsIndicators: false) { - VStack(alignment: .center, spacing: 20) { - versionSection - copyrightSection - acknowledgementsSection - } - .padding(.horizontal, 16) + ScrollView(showsIndicators: false) { + VStack(alignment: .center, spacing: 20) { + versionSection + copyrightSection + acknowledgementsSection } - .navigationBarTitleDisplayMode(.inline) - .navigationTitle("About the Readium Swift Toolkit") + .padding(.horizontal, 16) } } - + private var versionSection: some View { AboutSectionView( title: "Version", @@ -35,7 +31,7 @@ struct AboutView: View { Text(.appVersion ?? "") .foregroundColor(.primary) } - + HStack(spacing: 10) { Text("Build Version:") .foregroundColor(.secondary) @@ -46,7 +42,7 @@ struct AboutView: View { } } } - + private var copyrightSection: some View { AboutSectionView( title: "Copyright", @@ -57,7 +53,7 @@ struct AboutView: View { Text("© 2022 European Digital Reading Lab") .multilineTextAlignment(.leading) } - + Link(destination: .license) { Text("[BSD-3 License]") .multilineTextAlignment(.leading) @@ -66,7 +62,7 @@ struct AboutView: View { .frame(maxWidth: .infinity, alignment: .leading) } } - + private var acknowledgementsSection: some View { AboutSectionView( title: "Acknowledgements", @@ -94,7 +90,7 @@ struct About_Previews: PreviewProvider { private extension String { static let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - + static let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String } diff --git a/TestApp/Sources/App/AppModule.swift b/TestApp/Sources/App/AppModule.swift index d6b6cf01c..7873a02d9 100644 --- a/TestApp/Sources/App/AppModule.swift +++ b/TestApp/Sources/App/AppModule.swift @@ -58,7 +58,12 @@ final class AppModule { ReadiumEnableLog(withMinimumSeverityLevel: .warning) } - private(set) lazy var aboutViewController = UIHostingController(rootView: AboutView()) + private(set) lazy var aboutViewController: UIViewController = { + let hostingController = UIHostingController(rootView: AboutView()) + hostingController.navigationItem.title = "About the Readium Swift Toolkit" + hostingController.navigationItem.largeTitleDisplayMode = .never + return UINavigationController(rootViewController: hostingController) + }() } extension AppModule: ModuleDelegate { From 12cbb2c763c15a5ff7a323feab368c7f3d6604ca Mon Sep 17 00:00:00 2001 From: Kirill Shakhansky Date: Thu, 17 Oct 2024 17:09:26 +0300 Subject: [PATCH 21/21] swiftformat --- TestApp/Sources/About/AboutSectionView.swift | 41 ++++++++++---------- TestApp/Sources/About/AboutView.swift | 12 +++--- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/TestApp/Sources/About/AboutSectionView.swift b/TestApp/Sources/About/AboutSectionView.swift index b5baa5eca..a825dd652 100644 --- a/TestApp/Sources/About/AboutSectionView.swift +++ b/TestApp/Sources/About/AboutSectionView.swift @@ -7,17 +7,16 @@ import SwiftUI struct AboutSectionView: View { - enum Icon: String { case app = "app.badge" case circle = "c.circle" case hands = "hands.sparkles" } - + private let title: String private let icon: Icon private var content: () -> Content - + init( title: String, icon: Icon, @@ -27,7 +26,7 @@ struct AboutSectionView: View { self.icon = icon self.content = content } - + var body: some View { GroupBox { content() @@ -46,23 +45,23 @@ struct AboutSectionView: View { #Preview { AboutSectionView(title: "Version", icon: .app) { - VStack { - HStack { - Text("App Version:") - .foregroundColor(.gray) - Spacer() - Text("alpha-3.0") - .foregroundColor(.primary) - } - - HStack(spacing: 10) { - Text("Build Version:") - .foregroundColor(.gray) - Spacer() - Text("alpha-3.0") - .foregroundColor(.primary) - } + VStack { + HStack { + Text("App Version:") + .foregroundColor(.gray) + Spacer() + Text("alpha-3.0") + .foregroundColor(.primary) + } + + HStack(spacing: 10) { + Text("Build Version:") + .foregroundColor(.gray) + Spacer() + Text("alpha-3.0") + .foregroundColor(.primary) } } - .padding() + } + .padding() } diff --git a/TestApp/Sources/About/AboutView.swift b/TestApp/Sources/About/AboutView.swift index 6af0c10ad..c907dc255 100644 --- a/TestApp/Sources/About/AboutView.swift +++ b/TestApp/Sources/About/AboutView.swift @@ -17,7 +17,7 @@ struct AboutView: View { .padding(.horizontal, 16) } } - + private var versionSection: some View { AboutSectionView( title: "Version", @@ -31,7 +31,7 @@ struct AboutView: View { Text(.appVersion ?? "") .foregroundColor(.primary) } - + HStack(spacing: 10) { Text("Build Version:") .foregroundColor(.secondary) @@ -42,7 +42,7 @@ struct AboutView: View { } } } - + private var copyrightSection: some View { AboutSectionView( title: "Copyright", @@ -53,7 +53,7 @@ struct AboutView: View { Text("© 2022 European Digital Reading Lab") .multilineTextAlignment(.leading) } - + Link(destination: .license) { Text("[BSD-3 License]") .multilineTextAlignment(.leading) @@ -62,7 +62,7 @@ struct AboutView: View { .frame(maxWidth: .infinity, alignment: .leading) } } - + private var acknowledgementsSection: some View { AboutSectionView( title: "Acknowledgements", @@ -90,7 +90,7 @@ struct About_Previews: PreviewProvider { private extension String { static let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - + static let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String }