Skip to content

Commit

Permalink
Fixed macOS compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanLipnik committed Sep 29, 2021
1 parent 991293a commit 0b75498
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Shared/Documents/ImportDocumentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct ImportDocumentView: View {
}
}
}
#if os(iOS)
.listStyle(.insetGrouped)
.navigationTitle(file.url.lastPathComponent)
.navigationBarTitleDisplayMode(.inline)
Expand All @@ -76,6 +77,9 @@ struct ImportDocumentView: View {
dismiss.callAsFunction()
}
}
#else
.listStyle(.inset(alternatesRowBackgrounds: true))
#endif
}

private func add(encryptionKey: SymmetricKey) throws {
Expand Down
6 changes: 5 additions & 1 deletion Shared/Views/ContentView/ContentView+List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ extension ContentView {
Button {
guard let writeReviewURL = URL(string: "https://apps.apple.com/app/id1581907821?action=write-review")
else { fatalError("Expected a valid URL") }
UIApplication.shared.open(writeReviewURL, options: [:], completionHandler: nil)
#if os(iOS)
UIApplication.shared.open(writeReviewURL, options: [:], completionHandler: nil)
#else
NSWorkspace.shared.open(writeReviewURL)
#endif

UserDefaults.standard.set(true, forKey: "didRequestReview")
} label: {
Expand Down
2 changes: 2 additions & 0 deletions Shared/Views/ContentView/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ struct ContentView_Previews: PreviewProvider {
}
}

#if os(iOS)
extension UISplitViewController {
open override func viewDidLoad() {
super.viewDidLoad()
self.show(.primary)
}
}
#endif
2 changes: 1 addition & 1 deletion Shared/Views/NoteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ struct NoteView: View {
Spacer()
.frame(maxWidth: .infinity)
}
.navigationBarTitleDisplayMode(.inline)
.onAppear {
displayedBody = CryptoSecurityService.randomString(length: Int(note.bodyLength))!
newColor = Int(note.color)
Expand All @@ -110,6 +109,7 @@ struct NoteView: View {
print(color)
}
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button {
Expand Down

0 comments on commit 0b75498

Please sign in to comment.