From b32a501ad87437080a23e294dae12924d6a49ea3 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Thu, 28 Nov 2024 08:58:55 +0800 Subject: [PATCH] feat: add openURL func. --- README.md | 4 ++++ Sources/MyAppListKit/MyAppListKit.swift | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index ab598b8..0150b5b 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ List { }) } } + +Button("More Apps by Me") { + MyAppList.openURL(url: URL(string: MyAppList.appsByMe)!) +} ``` ## License diff --git a/Sources/MyAppListKit/MyAppListKit.swift b/Sources/MyAppListKit/MyAppListKit.swift index e2c786e..2eb1875 100644 --- a/Sources/MyAppListKit/MyAppListKit.swift +++ b/Sources/MyAppListKit/MyAppListKit.swift @@ -102,6 +102,11 @@ public struct MyAppList { } #endif } + public static func openURL(string: String) { + if let url = URL(string: string) { + openURL(url: url) + } + } public static var appsByMe: String { #if os(macOS)