From 2e2cc24e3836c3dd4b472740c2c87dd5eab85353 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Wed, 17 Jul 2024 21:44:06 +0700 Subject: [PATCH] feat: add about view --- Memola.xcodeproj/project.pbxproj | 16 ++++++++++ Memola/Config/Info.plist | 2 ++ .../Features/Settings/About/AboutView.swift | 29 +++++++++++++++++++ .../Settings/Settings/SettingsView.swift | 13 +++++++-- Memola/Utilies/Extensions/Bundle++.swift | 16 ++++++++++ 5 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 Memola/Features/Settings/About/AboutView.swift create mode 100644 Memola/Utilies/Extensions/Bundle++.swift diff --git a/Memola.xcodeproj/project.pbxproj b/Memola.xcodeproj/project.pbxproj index 07a3bc7..05dbc71 100644 --- a/Memola.xcodeproj/project.pbxproj +++ b/Memola.xcodeproj/project.pbxproj @@ -34,6 +34,8 @@ EC2106AD2C10C2A700FBE27C /* AnyStroke.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2106AC2C10C2A700FBE27C /* AnyStroke.swift */; }; EC2117632C47FA30005B32A1 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2117622C47FA30005B32A1 /* SettingsView.swift */; }; EC2117662C4802C0005B32A1 /* AppWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2117652C4802C0005B32A1 /* AppWindow.swift */; }; + EC2117692C480D4D005B32A1 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2117682C480D4D005B32A1 /* AboutView.swift */; }; + EC21176B2C480EE6005B32A1 /* Bundle++.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC21176A2C480EE6005B32A1 /* Bundle++.swift */; }; EC2BEBF42C0F5FF7005DB0AF /* RTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2BEBF32C0F5FF7005DB0AF /* RTree.swift */; }; EC2BEBF62C0F600D005DB0AF /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2BEBF52C0F600D005DB0AF /* Box.swift */; }; EC2BEBF82C0F601A005DB0AF /* Node.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2BEBF72C0F601A005DB0AF /* Node.swift */; }; @@ -173,6 +175,8 @@ EC2106AC2C10C2A700FBE27C /* AnyStroke.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyStroke.swift; sourceTree = ""; }; EC2117622C47FA30005B32A1 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; EC2117652C4802C0005B32A1 /* AppWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppWindow.swift; sourceTree = ""; }; + EC2117682C480D4D005B32A1 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = ""; }; + EC21176A2C480EE6005B32A1 /* Bundle++.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle++.swift"; sourceTree = ""; }; EC2BEBF32C0F5FF7005DB0AF /* RTree.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTree.swift; sourceTree = ""; }; EC2BEBF52C0F600D005DB0AF /* Box.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Box.swift; sourceTree = ""; }; EC2BEBF72C0F601A005DB0AF /* Node.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Node.swift; sourceTree = ""; }; @@ -446,6 +450,7 @@ EC2117602C47FA14005B32A1 /* Settings */ = { isa = PBXGroup; children = ( + EC2117672C480D45005B32A1 /* About */, EC2117612C47FA29005B32A1 /* Settings */, ); path = Settings; @@ -467,6 +472,14 @@ path = AppWindow; sourceTree = ""; }; + EC2117672C480D45005B32A1 /* About */ = { + isa = PBXGroup; + children = ( + EC2117682C480D4D005B32A1 /* AboutView.swift */, + ); + path = About; + sourceTree = ""; + }; EC2BEBF22C0F5FE1005DB0AF /* RTree */ = { isa = PBXGroup; children = ( @@ -1010,6 +1023,7 @@ ECF7B2CC2C39169C004D2C57 /* simd_float4x4++.swift */, ECF7B2CD2C39169C004D2C57 /* Image++.swift */, ECF7B2CE2C39169C004D2C57 /* View++.swift */, + EC21176A2C480EE6005B32A1 /* Bundle++.swift */, ); path = Extensions; sourceTree = ""; @@ -1182,6 +1196,7 @@ EC2BEBF62C0F600D005DB0AF /* Box.swift in Sources */, ECA738832BE5FEFE00A4542E /* RenderPass.swift in Sources */, ECEC01A82BEE11BA006DA24C /* QuadShape.swift in Sources */, + EC2117692C480D4D005B32A1 /* AboutView.swift in Sources */, ECF7B2DC2C39169C004D2C57 /* MTLTexture++.swift in Sources */, ECA738862BE5FF2500A4542E /* Canvas.swift in Sources */, ECF7B2DE2C39169C004D2C57 /* NSManagedObjectContext++.swift in Sources */, @@ -1245,6 +1260,7 @@ EC5050072BF65CED00B4D86E /* PenDropDelegate.swift in Sources */, ECF7B2E42C39174D004D2C57 /* Platform.swift in Sources */, ECA738C12BE60E5300A4542E /* PenStyle.swift in Sources */, + EC21176B2C480EE6005B32A1 /* Bundle++.swift in Sources */, EC2002D72C4160EF002EBD5F /* EditCommands.swift in Sources */, ECF7B2DF2C39169C004D2C57 /* simd_float4x4++.swift in Sources */, ECF7B2D02C39169C004D2C57 /* Array++.swift in Sources */, diff --git a/Memola/Config/Info.plist b/Memola/Config/Info.plist index e0a7480..d71b4c0 100644 --- a/Memola/Config/Info.plist +++ b/Memola/Config/Info.plist @@ -2,6 +2,8 @@ + NSHumanReadableCopyright + Copyright © 2024 Memola. All rights reserved. CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/Memola/Features/Settings/About/AboutView.swift b/Memola/Features/Settings/About/AboutView.swift new file mode 100644 index 0000000..871c3ab --- /dev/null +++ b/Memola/Features/Settings/About/AboutView.swift @@ -0,0 +1,29 @@ +// +// AboutView.swift +// Memola +// +// Created by Dscyre Scotti on 7/17/24. +// + +import SwiftUI + +struct AboutView: View { + var body: some View { + List { + Section { + HStack { + Text("App Version") + Spacer() + Text("v\(Bundle.main.appVersion) (\(Bundle.main.appBuild))") + } + } + Section("Copyright") { + Text(Bundle.main.copyright) + .font(.callout) + } + } + .listStyle(.insetGrouped) + .navigationTitle("About") + .navigationBarTitleDisplayMode(.inline) + } +} diff --git a/Memola/Features/Settings/Settings/SettingsView.swift b/Memola/Features/Settings/Settings/SettingsView.swift index bbbbd8a..dde6017 100644 --- a/Memola/Features/Settings/Settings/SettingsView.swift +++ b/Memola/Features/Settings/Settings/SettingsView.swift @@ -10,10 +10,19 @@ import SwiftUI struct SettingsView: View { var body: some View { NavigationStack { - Text("Settings View") - .navigationTitle("Settings") + List { + NavigationLink { + AboutView() + } label: { + Label("About", systemImage: "info.circle.fill") + .foregroundStyle(.primary) + } + } + .navigationTitle("Settings") + .navigationBarTitleDisplayMode(.large) } .focusedSceneValue(\.activeSceneKey, .settings) + .interactiveDismissDisabled() } } diff --git a/Memola/Utilies/Extensions/Bundle++.swift b/Memola/Utilies/Extensions/Bundle++.swift new file mode 100644 index 0000000..d22aa37 --- /dev/null +++ b/Memola/Utilies/Extensions/Bundle++.swift @@ -0,0 +1,16 @@ +// +// Bundle++.swift +// Memola +// +// Created by Dscyre Scotti on 7/17/24. +// + +import Foundation + +extension Bundle { + var appBuild: String { getInfo("CFBundleVersion") } + var appVersion: String { getInfo("CFBundleShortVersionString") } + var copyright: String { getInfo("NSHumanReadableCopyright") } + + fileprivate func getInfo(_ key: String) -> String { infoDictionary?[key] as! String } +}