Skip to content

Commit a10b55b

Browse files
committed
Initial macOS support
1 parent 4f56a53 commit a10b55b

File tree

8 files changed

+31
-13
lines changed

8 files changed

+31
-13
lines changed

Shared/Components/LaunchRow.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import SwiftUI
1111
struct LaunchRow: View {
1212
let launch: Launch
1313

14+
#if os(iOS)
15+
let padding: CGFloat = 0
16+
#else
17+
let padding: CGFloat = 8
18+
#endif
19+
1420
var body: some View {
1521
NavigationLink(destination: LaunchDetailView(launch: launch)) {
1622
HStack {
@@ -31,7 +37,7 @@ struct LaunchRow: View {
3137
.font(.subheadline)
3238
.foregroundColor(.secondary)
3339
}
34-
}
40+
}.padding(.vertical, padding)
3541
}
3642
}
3743
}

Shared/Navigation/AppSidebarNavigation.swift

+2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ struct AppSidebarNavigation: View {
2525
.tag(NavigationItem.launches)
2626
}
2727

28+
#if os(iOS)
2829
NavigationLink(destination: SearchView()) {
2930
Label("Search", systemImage: "magnifyingglass")
3031
.tag(NavigationItem.search)
3132
}
33+
#endif
3234
}
3335
.listStyle(SidebarListStyle())
3436
.navigationTitle("SpaceX")

Shared/Views/LaunchDetailView.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import SwiftUI
1111
struct LaunchDetailView: View {
1212
let launch: Launch
1313

14+
#if os(iOS)
15+
let listStyle = GroupedListStyle()
16+
#else
17+
let listStyle = DefaultListStyle()
18+
#endif
19+
1420
var body: some View {
1521
List {
1622
// Patch
@@ -59,7 +65,7 @@ struct LaunchDetailView: View {
5965
}
6066
}
6167
}
62-
.listStyle(GroupedListStyle())
68+
.listStyle(listStyle)
6369
.navigationTitle(launch.name)
6470
}
6571
}

Shared/Views/LaunchesView.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ import SwiftUI
1010
struct LaunchesView: View {
1111
@EnvironmentObject private var store: Store
1212

13+
#if os(iOS)
14+
let listStyle = PlainListStyle()
15+
#else
16+
let listStyle = DefaultListStyle()
17+
#endif
18+
1319
var body: some View {
1420
if store.upcomingLaunches.isEmpty || store.pastLaunches.isEmpty {
1521
ProgressView()
@@ -38,7 +44,7 @@ struct LaunchesView: View {
3844
LaunchRow(launch: launch)
3945
}
4046
}
41-
}.listStyle(PlainListStyle())
47+
}.listStyle(listStyle)
4248
}
4349

4450
struct Header: View {

SpaceX.xcodeproj/project.pbxproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
C2D2C3C0251A92D500E19B68 /* KingfisherSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = C2D2C3BF251A92D500E19B68 /* KingfisherSwiftUI */; };
3636
C2D2C3C5251A92EF00E19B68 /* KingfisherSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = C2D2C3C4251A92EF00E19B68 /* KingfisherSwiftUI */; };
3737
C2F23821251B492300F43577 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F23820251B492300F43577 /* SearchBar.swift */; };
38-
C2F23822251B492300F43577 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F23820251B492300F43577 /* SearchBar.swift */; };
3938
C2F23826251B4AB800F43577 /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F23825251B4AB800F43577 /* SearchView.swift */; };
40-
C2F23827251B4AB800F43577 /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F23825251B4AB800F43577 /* SearchView.swift */; };
4139
/* End PBXBuildFile section */
4240

4341
/* Begin PBXFileReference section */
@@ -87,7 +85,6 @@
8785
isa = PBXGroup;
8886
children = (
8987
C2ADB2EA251AA51200B1C144 /* LaunchesView.swift */,
90-
C2F23825251B4AB800F43577 /* SearchView.swift */,
9188
C21EFD5D251C396D0026D25B /* LaunchDetailView.swift */,
9289
);
9390
path = Views;
@@ -97,7 +94,6 @@
9794
isa = PBXGroup;
9895
children = (
9996
C2ADB2D7251A9E4E00B1C144 /* LaunchRow.swift */,
100-
C2F23820251B492300F43577 /* SearchBar.swift */,
10197
C21EFD58251C37630026D25B /* ClickableDate.swift */,
10298
);
10399
path = Components;
@@ -153,6 +149,8 @@
153149
children = (
154150
C2794798251981FC008F8FFD /* Info.plist */,
155151
C223DB46251B7E090042A438 /* AppTabNavigation.swift */,
152+
C2F23820251B492300F43577 /* SearchBar.swift */,
153+
C2F23825251B4AB800F43577 /* SearchView.swift */,
156154
);
157155
path = iOS;
158156
sourceTree = "<group>";
@@ -308,15 +306,13 @@
308306
isa = PBXSourcesBuildPhase;
309307
buildActionMask = 2147483647;
310308
files = (
311-
C2F23827251B4AB800F43577 /* SearchView.swift in Sources */,
312309
C2ADB2D4251A9CE200B1C144 /* Store.swift in Sources */,
313310
C21EFD5A251C37630026D25B /* ClickableDate.swift in Sources */,
314311
C223DB4C251B7F070042A438 /* AppSidebarNavigation.swift in Sources */,
315312
C2ADB2D9251A9E4E00B1C144 /* LaunchRow.swift in Sources */,
316313
C27947A4251981FC008F8FFD /* ContentView.swift in Sources */,
317314
C2ADB2EC251AA51200B1C144 /* LaunchesView.swift in Sources */,
318315
C2ADB2DE251AA17100B1C144 /* Utils.swift in Sources */,
319-
C2F23822251B492300F43577 /* SearchBar.swift in Sources */,
320316
C2161C3D25198E2900ECE862 /* API.swift in Sources */,
321317
C21EFD5F251C396D0026D25B /* LaunchDetailView.swift in Sources */,
322318
C2ADB2CF251A9B1000B1C144 /* Launch.swift in Sources */,
File renamed without changes.
File renamed without changes.

macOS/macOS.entitlements

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>com.apple.security.app-sandbox</key>
6-
<true/>
7-
<key>com.apple.security.files.user-selected.read-only</key>
8-
<true/>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.files.user-selected.read-only</key>
8+
<true/>
9+
<key>com.apple.security.network.client</key>
10+
<true/>
911
</dict>
1012
</plist>

0 commit comments

Comments
 (0)