Skip to content

Commit 0fd417c

Browse files
Merge pull request #42 from Modernism-in-Architecture/feature/#36-refactor-navigation-to-iOS16
2 parents d8e3ec8 + e31398d commit 0fd417c

File tree

52 files changed

+1046
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1046
-381
lines changed

MIAapp.xcodeproj/project.pbxproj

Lines changed: 104 additions & 32 deletions
Large diffs are not rendered by default.

MIAapp.xcodeproj/xcshareddata/xcschemes/MIAapp.xcscheme

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1500"
3+
LastUpgradeVersion = "1530"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -50,6 +50,13 @@
5050
ReferencedContainer = "container:MIAapp.xcodeproj">
5151
</BuildableReference>
5252
</BuildableProductRunnable>
53+
<EnvironmentVariables>
54+
<EnvironmentVariable
55+
key = "OS_ACTIVITY_MODE"
56+
value = "disable"
57+
isEnabled = "NO">
58+
</EnvironmentVariable>
59+
</EnvironmentVariables>
5360
</LaunchAction>
5461
<ProfileAction
5562
buildConfiguration = "Release"

MIAapp/Constants.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ import MapKit
1010

1111
extension Color {
1212

13-
static let shadow = Color("shadow")
14-
static let bookmarkShadow = Color("bookmarkShadow")
15-
static let cellBackground = Color("cellBackground")
16-
static let closeButtonForeground = Color("closeButtonForeground")
1713
static let background = Color(UIColor.systemBackground)
1814
static let secondaryBackground = Color(UIColor.secondarySystemBackground)
1915
static let tertiaryBackground = Color(UIColor.tertiarySystemBackground)

MIAapp/ContentView.swift

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,28 @@ import SwiftUI
1111

1212
struct ContentView: View {
1313

14-
@EnvironmentObject var tabController: TabController
14+
@EnvironmentObject var router: MIARouter
1515
@EnvironmentObject var cloudKitBookmarksController: BookmarksViewModel
1616

1717
var body: some View {
18-
TabView(selection: $tabController.selection) {
19-
BuildingsListView().tabItem {
20-
Label("Buildings", systemImage: "building.2")
21-
}.tag(TabController.Tab.buildings)
22-
MIAMapView().tabItem {
23-
Label("Places", systemImage: "map")
24-
}.tag(TabController.Tab.map)
25-
ArchitectsListView().tabItem {
26-
Label("Architects", systemImage: "person.2")
27-
}.tag(TabController.Tab.architects)
28-
BookmarksView().tabItem {
29-
Label("Bookmarks", systemImage: "bookmark")
30-
}.tag(TabController.Tab.bookmarks)
31-
// .badge(cloudKitBookmarksController.bookmarks.count)
18+
19+
TabView(selection: $router.selectedTab) {
20+
21+
ForEach(MIARouter.MainScreen.allCases) { tab in
22+
23+
tab.rootView
24+
.toolbar(router.tabBarVisibility, for: .tabBar)
25+
.tag(tab as MIARouter.MainScreen)
26+
.tabItem { tab.label }
27+
}
3228
}
3329
}
3430
}
3531

3632
// MARK: - ContentView_Previews
3733

3834
struct ContentView_Previews: PreviewProvider {
35+
3936
static var previews: some View {
4037
ContentView()
4138
}

MIAapp/Extensions.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ extension URL: Identifiable {
1616
public var id: Self { self }
1717
}
1818

19-
20-
2119
extension CLLocation {
20+
2221
convenience init(_ location: CLLocationCoordinate2D) {
2322
self.init(latitude: location.latitude, longitude: location.longitude)
2423
}
2524
}
25+
26+
extension CLLocationCoordinate2D {
27+
28+
var debugDescription: String {
29+
"coordinate latitude: \(self.latitude), longitude: \(self.longitude)"
30+
}
31+
}

MIAapp/Info.plist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>ITSAppUsesNonExemptEncryption</key>
6+
<false/>
7+
</dict>
8+
</plist>

MIAapp/MIAappApp.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,29 @@ import SwiftUI
1010
@main
1111
struct MIAappApp: App {
1212

13-
@StateObject var buildingsController = BuildingsListViewModel()
14-
@StateObject var architectsController = ArchitectsListViewModel()
15-
@StateObject var tabController = TabController()
13+
@StateObject var router = MIARouter()
14+
@StateObject var buildingsListViewModel = BuildingsListViewModel()
15+
@StateObject var mapViewModel = MIAMapViewModel()
16+
@StateObject var architectsListViewModel = ArchitectsListViewModel()
1617
@StateObject var cloudKitBookmarksController = BookmarksViewModel()
1718

1819
var body: some Scene {
1920

2021
WindowGroup {
2122

2223
ContentView()
23-
.environmentObject(buildingsController)
24-
.environmentObject(architectsController)
25-
.environmentObject(tabController)
24+
.environmentObject(router)
25+
.environmentObject(buildingsListViewModel)
26+
.environmentObject(mapViewModel)
27+
.environmentObject(architectsListViewModel)
2628
.environmentObject(cloudKitBookmarksController)
2729
.task {
2830

29-
await buildingsController.fetchData()
30-
await architectsController.fetchData()
31+
await buildingsListViewModel.fetchData()
32+
await architectsListViewModel.fetchData()
33+
}
34+
.onOpenURL { url in
35+
print("Received deep link: \(url)")
3136
}
3237
}
3338
}

MIAapp/PrivacyInfo.xcprivacy

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSPrivacyCollectedDataTypes</key>
6+
<array>
7+
<dict>
8+
<key>NSPrivacyCollectedDataType</key>
9+
<string>NSPrivacyCollectedDataTypePreciseLocation</string>
10+
<key>NSPrivacyCollectedDataTypeLinked</key>
11+
<false/>
12+
<key>NSPrivacyCollectedDataTypeTracking</key>
13+
<false/>
14+
<key>NSPrivacyCollectedDataTypePurposes</key>
15+
<array>
16+
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
17+
</array>
18+
</dict>
19+
</array>
20+
<key>NSPrivacyTracking</key>
21+
<false/>
22+
</dict>
23+
</plist>

MIAapp/View/ArchitectView/ArchitectView.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.

MIAapp/View/ArchitectView/ArchitectDetailView.swift renamed to MIAapp/View/Architects/ArchitectDetailView/ArchitectDetailSuccessView.swift

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@
77

88
import SwiftUI
99

10-
struct ArchitectDetailView: View {
10+
struct ArchitectDetailSuccessView: View {
11+
12+
@EnvironmentObject
13+
var router: MIARouter
1114

1215
let detail: ArchitectDetail
1316
let columns = [GridItem(.adaptive(minimum: 300, maximum: 400))]
1417

1518
var body: some View {
19+
1620
ScrollView {
21+
1722
VStack(alignment: .leading) {
23+
1824
MIASection("Architect") {
1925
architectDetails
2026
}
@@ -34,27 +40,37 @@ struct ArchitectDetailView: View {
3440
}
3541

3642
var architectDetails: some View {
43+
3744
VStack(alignment: .leading) {
45+
3846
Text(detail.fullName)
3947
.font(.headline)
4048
.padding(.bottom, 5)
4149
if !detail.birth.isEmpty {
50+
4251
Text("\(Image(systemName: "heart.circle")) \(detail.birth)")
4352
.lineLimit(1)
4453
}
4554
if !detail.death.isEmpty {
55+
4656
Text("\(Image(systemName: "heart.slash.circle")) \(detail.death)")
4757
.lineLimit(1)
4858
}
4959
}
5060
}
5161

5262
var buildings: some View {
63+
5364
LazyVGrid(columns: columns, alignment:.leading, spacing: 20) {
65+
5466
ForEach(detail.relatedBuildings) { building in
55-
NavigationLink(destination: BuildingView(building: building)) {
56-
BuildingsListCellView(building: building, searchText: "")
57-
}
67+
// NavigationLink(destination: BuildingDetailView(building: building)) {
68+
// BuildingsListCellView(building: building, searchText: "")
69+
// }
70+
BuildingsListCellView(building: building, searchText: "")
71+
.onTapGesture {
72+
router.showBuildingDetail(building: building)
73+
}
5874
.buttonStyle(.plain)
5975
}
6076
}

0 commit comments

Comments
 (0)