From e3b6dca80feddae1877bcd66a10a9eb11421231d Mon Sep 17 00:00:00 2001 From: Vincent Tourraine Date: Tue, 9 Jan 2024 09:52:57 +0100 Subject: [PATCH] Fix open URL on macOS with SwiftUI #114 --- CHANGELOG.md | 1 + Sources/AcknowList/AcknowListSwiftUI.swift | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae4b174..a83271e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Add `GitHubAPI` to get licenses from GitHub API - Update `AcknowListViewController` to get missing licenses from GitHub API, with new `canFetchLicenseFromGitHub` property to disable this behavior +- Fix open URL on macOS with SwiftUI ## 3.0.1 (24 November 2022) diff --git a/Sources/AcknowList/AcknowListSwiftUI.swift b/Sources/AcknowList/AcknowListSwiftUI.swift index 09675f0..7340038 100644 --- a/Sources/AcknowList/AcknowListSwiftUI.swift +++ b/Sources/AcknowList/AcknowListSwiftUI.swift @@ -126,7 +126,9 @@ public struct AcknowListRowSwiftUIView: View { else if let repository = acknowledgement.repository, canOpenRepository(for: repository) { Button(action: { -#if os(iOS) +#if os(macOS) + NSWorkspace.shared.open(repository) +#elseif os(iOS) UIApplication.shared.open(repository) #endif }) {