Skip to content

Commit

Permalink
swiftformat
Browse files Browse the repository at this point in the history
  • Loading branch information
FuzzzzyBoy committed Oct 17, 2024
1 parent 0ee0aa9 commit 12cbb2c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
41 changes: 20 additions & 21 deletions TestApp/Sources/About/AboutSectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
import SwiftUI

struct AboutSectionView<Content: View>: 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,
Expand All @@ -27,7 +26,7 @@ struct AboutSectionView<Content: View>: View {
self.icon = icon
self.content = content
}

var body: some View {
GroupBox {
content()
Expand All @@ -46,23 +45,23 @@ struct AboutSectionView<Content: View>: 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()
}
12 changes: 6 additions & 6 deletions TestApp/Sources/About/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct AboutView: View {
.padding(.horizontal, 16)
}
}

private var versionSection: some View {
AboutSectionView(
title: "Version",
Expand All @@ -31,7 +31,7 @@ struct AboutView: View {
Text(.appVersion ?? "")
.foregroundColor(.primary)
}

HStack(spacing: 10) {
Text("Build Version:")
.foregroundColor(.secondary)
Expand All @@ -42,7 +42,7 @@ struct AboutView: View {
}
}
}

private var copyrightSection: some View {
AboutSectionView(
title: "Copyright",
Expand All @@ -53,7 +53,7 @@ struct AboutView: View {
Text("© 2022 European Digital Reading Lab")
.multilineTextAlignment(.leading)
}

Link(destination: .license) {
Text("[BSD-3 License]")
.multilineTextAlignment(.leading)
Expand All @@ -62,7 +62,7 @@ struct AboutView: View {
.frame(maxWidth: .infinity, alignment: .leading)
}
}

private var acknowledgementsSection: some View {
AboutSectionView(
title: "Acknowledgements",
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 12cbb2c

Please sign in to comment.