From e03858df195e35eab27aacd8cdf6a9344e4de14c Mon Sep 17 00:00:00 2001 From: KonstantinHub Date: Mon, 9 Sep 2024 18:31:31 +0300 Subject: [PATCH] spm support --- OnlineChatSdk/Classes/ChatController.swift | 4 +++- Package.swift | 24 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Package.swift diff --git a/OnlineChatSdk/Classes/ChatController.swift b/OnlineChatSdk/Classes/ChatController.swift index fd07341..c35e7e7 100644 --- a/OnlineChatSdk/Classes/ChatController.swift +++ b/OnlineChatSdk/Classes/ChatController.swift @@ -463,7 +463,9 @@ open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessa } open func onLinkPressed(url: URL) { - UIApplication.shared.openURL(url) + if UIApplication.shared.canOpenURL(url) { + UIApplication.shared.open(url) + } } open func playSound(_ systemSoundId: SystemSoundID) { diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..3c76426 --- /dev/null +++ b/Package.swift @@ -0,0 +1,24 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "OnlineChatSdk", + platforms: [.iOS(.v12)], + products: [ + // Products define the executables and libraries a package produces, making them visible to other packages. + .library( + name: "OnlineChatSdk", + targets: ["OnlineChatSdk"]), + ], + targets: [ + // Targets are the basic building blocks of a package, defining a module or a test suite. + // Targets can depend on other targets in this package and products from dependencies. + .target( + name: "OnlineChatSdk", + path: "OnlineChatSdk", + sources: ["Classes"] + ) + ] +)