From a7f5f4c8f3e0a8f5dfec697bbbb1f3dc3530197f Mon Sep 17 00:00:00 2001 From: Kanz <87kangsw@gmail.com> Date: Mon, 18 Jan 2021 20:56:33 +0900 Subject: [PATCH 1/2] feat(ui): add usage view --- ThenGeneratorApp/Sources/Views/SideBar.swift | 63 ++++++++++--------- .../Sources/Views/UsageView.swift | 37 +++++++++++ 2 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 ThenGeneratorApp/Sources/Views/UsageView.swift diff --git a/ThenGeneratorApp/Sources/Views/SideBar.swift b/ThenGeneratorApp/Sources/Views/SideBar.swift index 27db04f..05431c3 100644 --- a/ThenGeneratorApp/Sources/Views/SideBar.swift +++ b/ThenGeneratorApp/Sources/Views/SideBar.swift @@ -11,38 +11,45 @@ struct SideBar: View { @EnvironmentObject private var homeState: HomeViewModel var body: some View { - List(selection: $homeState.selectedComponents) { + VStack { - Section(header: SectionHeaderView(category: .common)) { - NavigationLink( - destination: CommonComponent(), - label: { - TabButton(title: "Common") - }) - } - - // Text - ComponentSection(components: homeState.components.filter { $0.category == .text }, category: .text) + UsageView() - // Scroll - ComponentSection(components: homeState.components.filter { $0.category == .scroll }, category: .scroll) + Divider() - // Control - ComponentSection(components: homeState.components.filter { $0.category == .control }, category: .control) - - // Loading - ComponentSection(components: homeState.components.filter { $0.category == .loading }, category: .loading) - - // Picker - ComponentSection(components: homeState.components.filter { $0.category == .picker }, category: .picker) - - // Views - ComponentSection(components: homeState.components.filter { $0.category == .view }, category: .view) + List(selection: $homeState.selectedComponents) { + + Section(header: SectionHeaderView(category: .common)) { + NavigationLink( + destination: CommonComponent(), + label: { + TabButton(title: "Common") + }) + } + + // Text + ComponentSection(components: homeState.components.filter { $0.category == .text }, category: .text) + + // Scroll + ComponentSection(components: homeState.components.filter { $0.category == .scroll }, category: .scroll) + + // Control + ComponentSection(components: homeState.components.filter { $0.category == .control }, category: .control) + + // Loading + ComponentSection(components: homeState.components.filter { $0.category == .loading }, category: .loading) + + // Picker + ComponentSection(components: homeState.components.filter { $0.category == .picker }, category: .picker) + + // Views + ComponentSection(components: homeState.components.filter { $0.category == .view }, category: .view) + } + .environmentObject(homeState) + .animation(nil) + .listStyle(SidebarListStyle()) + .frame(minWidth: 250, idealWidth: 250, maxWidth: 400, maxHeight: .infinity) } - .environmentObject(homeState) - .animation(nil) - .listStyle(SidebarListStyle()) - .frame(minWidth: 250, idealWidth: 250, maxWidth: 400, maxHeight: .infinity) } } diff --git a/ThenGeneratorApp/Sources/Views/UsageView.swift b/ThenGeneratorApp/Sources/Views/UsageView.swift new file mode 100644 index 0000000..dfec978 --- /dev/null +++ b/ThenGeneratorApp/Sources/Views/UsageView.swift @@ -0,0 +1,37 @@ +// +// UsageView.swift +// ThenGeneratorApp +// +// Created by Kanz on 2021/01/18. +// + +import SwiftUI + +struct UsageView: View { + var body: some View { + Button(action: { + self.openGitHub() + }, label: { + HStack { + Text("How to use?") + + Spacer() + Image(systemName: "questionmark.circle.fill") + } + }) + .padding(.horizontal, 12.0) + .padding(.vertical, 8.0) + .buttonStyle(PlainButtonStyle()) + } + + private func openGitHub() { + guard let url = URL(string: "https://github.com/87kangsw/ThenGenerator") else { return } + NSWorkspace.shared.open(url) + } +} + +struct UsageView_Previews: PreviewProvider { + static var previews: some View { + UsageView() + } +} From 4bda52df91ea8483fb2e26533dae108e312875d4 Mon Sep 17 00:00:00 2001 From: Kanz <87kangsw@gmail.com> Date: Mon, 18 Jan 2021 21:11:10 +0900 Subject: [PATCH 2/2] bump version, build number --- ThenGenerator/Supporting Files/Info.plist | 4 ++-- ThenGeneratorApp/Supporting Files/Info.plist | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ThenGenerator/Supporting Files/Info.plist b/ThenGenerator/Supporting Files/Info.plist index 27f6029..548a4c6 100644 --- a/ThenGenerator/Supporting Files/Info.plist +++ b/ThenGenerator/Supporting Files/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.0 + 1.0.1 CFBundleVersion - $(CURRENT_PROJECT_VERSION) + 3 ITSAppUsesNonExemptEncryption LSMinimumSystemVersion diff --git a/ThenGeneratorApp/Supporting Files/Info.plist b/ThenGeneratorApp/Supporting Files/Info.plist index 395ef45..712824c 100644 --- a/ThenGeneratorApp/Supporting Files/Info.plist +++ b/ThenGeneratorApp/Supporting Files/Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.0 + 1.0.1 CFBundleVersion - $(CURRENT_PROJECT_VERSION) + 3 ITSAppUsesNonExemptEncryption LSApplicationCategoryType