Skip to content

Commit

Permalink
Replace os checks with canImport(UIKit) to improve visionOS support (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuther authored and Igor Moroz committed May 22, 2024
1 parent 946fda7 commit 84129cd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Sources/Private/Model/DotLottie/DotLottieImageProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ class DotLottieImageProvider: AnimationImageProvider {

private func loadImages() {
for url in filepath.urls {
#if os(iOS) || os(tvOS) || os(watchOS) || targetEnvironment(macCatalyst)
#if canImport(UIKit)
if
let data = try? Data(contentsOf: url),
let image = UIImage(data: data)?.cgImage
{
images[url.lastPathComponent] = image
}
#elseif os(macOS)
#elseif canImport(AppKit)
if
let data = try? Data(contentsOf: url),
let image = NSImage(data: data)?.lottie_CGImage
Expand Down
2 changes: 1 addition & 1 deletion Sources/Private/Model/Extensions/Bundle.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
#if os(iOS) || os(tvOS) || os(watchOS) || targetEnvironment(macCatalyst)
#if canImport(UIKit)
import UIKit
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
#if os(iOS) || os(tvOS) || os(watchOS) || targetEnvironment(macCatalyst)
#if canImport(UIKit)

/// An Objective-C compatible wrapper around Lottie's AnimationKeypath
@objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
#if os(iOS) || os(tvOS) || os(watchOS) || targetEnvironment(macCatalyst)
#if canImport(UIKit)
import UIKit

/// An Objective-C compatible wrapper around Lottie's Animation class.
Expand Down

0 comments on commit 84129cd

Please sign in to comment.