From 2115236e7c20ee66aca3804fa2641557ce8fa9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Jose=CC=81=20Pereira=20Vieito?= Date: Tue, 16 Jan 2024 00:03:56 +0100 Subject: [PATCH] Added visionOS support --- Sources/Validation.swift | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Sources/Validation.swift b/Sources/Validation.swift index 434faca..41680fb 100644 --- a/Sources/Validation.swift +++ b/Sources/Validation.swift @@ -6,14 +6,17 @@ // Copyright © 2017-2021 Pavel Tikhonenko. All rights reserved. // -#if os(iOS) || os(tvOS) -import UIKit -#elseif os(watchOS) +#if canImport(UIKit) import UIKit +#endif + +#if os(watchOS) import WatchKit -#elseif os(macOS) -import IOKit +#endif + +#if canImport(Cocoa) import Cocoa +import IOKit #endif import CommonCrypto @@ -287,9 +290,6 @@ fileprivate func guid() -> Data #if os(watchOS) var uuidBytes = WKInterfaceDevice.current().identifierForVendor!.uuid return Data(bytes: &uuidBytes, count: MemoryLayout.size(ofValue: uuidBytes)) -#elseif !targetEnvironment(macCatalyst) && (os(iOS) || os(tvOS)) - var uuidBytes = UIDevice.current.identifierForVendor!.uuid - return Data(bytes: &uuidBytes, count: MemoryLayout.size(ofValue: uuidBytes)) #elseif targetEnvironment(macCatalyst) || os(macOS) if let guid = getMacAddress() @@ -300,6 +300,9 @@ fileprivate func guid() -> Data } return Data() // Never get called +#elseif canImport(UIKit) + var uuidBytes = UIDevice.current.identifierForVendor!.uuid + return Data(bytes: &uuidBytes, count: MemoryLayout.size(ofValue: uuidBytes)) #endif }