Skip to content

Commit

Permalink
feat: Add visionOS support (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanniks authored Sep 7, 2023
1 parent cfa7208 commit 4579425
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/Packages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
#if os(OSX)
import AppKit
typealias Image = NSImage
#elseif os(iOS) || targetEnvironment(macCatalyst) || os(tvOS)
#elseif os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(visionOS)
import UIKit
typealias Image = UIImage
#endif
Expand Down Expand Up @@ -214,7 +214,7 @@ struct Device: Codable {
let macName = Host.current().name ?? "Unknown Mac Devices"
name = macName
model = "\(macName) \(ProcessInfo.processInfo.operatingSystemVersionString)"
#elseif os(iOS) || targetEnvironment(macCatalyst) || os(tvOS)
#elseif os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(visionOS)
let device = UIDevice.current
name = device.name
model = "\(device.name) (\(device.systemName) \(device.systemVersion))"
Expand Down Expand Up @@ -410,7 +410,7 @@ extension Image {
return nil
}
return Image(named: iconName)
#elseif os(iOS) || os(tvOS)
#elseif os(iOS) || os(tvOS) || os(visionOS)
guard let iconsDictionary = Bundle.main.infoDictionary?["CFBundleIcons"] as? [String: Any],
let primaryIconsDictionary = iconsDictionary["CFBundlePrimaryIcon"] as? [String: Any],
let iconFiles = primaryIconsDictionary["CFBundleIconFiles"] as? [String],
Expand All @@ -426,7 +426,7 @@ extension Image {
// Resize, we don't need 1024px size
newRep.size = CGSize(width: 64, height: 64)
return newRep.representation(using: .png, properties: [:])
#elseif os(iOS) || targetEnvironment(macCatalyst) || os(tvOS)
#elseif os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(visionOS)
// It's already by 64px
return self.pngData()
#endif
Expand Down

0 comments on commit 4579425

Please sign in to comment.