Skip to content

Commit

Permalink
Make it better for cross-platform apps with SwiftUI
Browse files Browse the repository at this point in the history
  • Loading branch information
DevOpsThinh committed Dec 13, 2022
1 parent 5539fed commit 48f1543
Showing 1 changed file with 47 additions and 26 deletions.
73 changes: 47 additions & 26 deletions Sources/TutorialAbout/View/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,61 @@ public struct AboutView: View {
public init (react_items: [AboutModel]) {
self.items = react_items
}

// MARK: - COMPILER DIRECTIVE
#if os(iOS)
@Environment(\.horizontalSizeClass) var hsClass: UserInterfaceSizeClass?
#endif

// MARK: - SOME SORT OF VIEW
public var body: some View {
NavigationView {
VStack {
AboutBackgroundView()
.padding(.top, -15)

List {
Section(
header: Text(NSLocalizedString("IMPROVEMENT US", comment: "IMPROVEMENT US"))
.font(.custom("Nunito-Regular", size: 25, relativeTo: .largeTitle))
) {
ForEach(improvementCase(items: items)) {
AboutSectionView(aboutModel: $0)
}
}
#if os(iOS)
if hsClass == .compact {
NavigationView {
view
}
.accentColor(Color("AccentColor"))
} else {
view
}
#else
view
.frame(minWidth: 400, minHeight: 600)
#endif
}

Section(
header: Text(NSLocalizedString("CONNECTING WITH US", comment: "CONNECTING WITH US"))
.font(.custom("Nunito-Regular", size: 25, relativeTo: .largeTitle))
) {
ForEach(socialCase(items: items)) {
AboutSectionView(aboutModel: $0)
}
@ViewBuilder
private var view: some View {
VStack {
AboutBackgroundView()
.padding(.top, -15)

List {
Section(
header: Text(NSLocalizedString("IMPROVEMENT US", comment: "IMPROVEMENT US"))
.font(.custom("Nunito-Regular", size: 25, relativeTo: .largeTitle))
) {
ForEach(improvementCase(items: items)) {
AboutSectionView(aboutModel: $0)
}
}
.listStyle(.grouped)
.padding(.top, -15)

Spacer()
Section(
header: Text(NSLocalizedString("CONNECTING WITH US", comment: "CONNECTING WITH US"))
.font(.custom("Nunito-Regular", size: 25, relativeTo: .largeTitle))
) {
ForEach(socialCase(items: items)) {
AboutSectionView(aboutModel: $0)
}
}
}
.navigationTitle(NSLocalizedString("About Us", comment: "About Us"))
.navigationBarTitleDisplayMode(.automatic)
.listStyle(.grouped)
.padding(.top, -15)

Spacer()
}
.navigationTitle(NSLocalizedString("About Us", comment: "About Us"))
.navigationBarTitleDisplayMode(.automatic)
}

// MARK: - METHODS
Expand Down

0 comments on commit 48f1543

Please sign in to comment.