@@ -11,7 +11,7 @@ import Foundation
1111#if os(OSX)
1212import AppKit
1313typealias Image = NSImage
14- #elseif os(iOS)
14+ #elseif os(iOS) || targetEnvironment(macCatalyst)
1515import UIKit
1616typealias Image = UIImage
1717#endif
@@ -131,7 +131,7 @@ struct Device: Codable {
131131 let macName = Host . current ( ) . name ?? " Unknown Mac Devices "
132132 name = macName
133133 model = " \( macName) \( ProcessInfo . processInfo. operatingSystemVersionString) "
134- #elseif os(iOS)
134+ #elseif os(iOS) || targetEnvironment(macCatalyst)
135135 let device = UIDevice . current
136136 name = device. name
137137 model = " \( device. name) ( \( device. systemName) \( device. systemVersion) ) "
@@ -236,9 +236,14 @@ extension Image {
236236 static var appIcon : Image ? {
237237 #if os(OSX)
238238 return NSApplication . shared. applicationIconImage
239+ #elseif targetEnvironment(macCatalyst)
240+ guard let iconName = Bundle . main. infoDictionary ? [ " CFBundleIconFile " ] as? String else {
241+ return nil
242+ }
243+ return Image ( named: iconName)
239244 #elseif os(iOS)
240- guard let iconsDictionary = Bundle . main. infoDictionary ? [ " CFBundleIcons " ] as? [ String : Any ] ,
241- let primaryIconsDictionary = iconsDictionary [ " CFBundlePrimaryIcon " ] as? [ String : Any ] ,
245+ guard let iconsDictionary = Bundle . main. infoDictionary ? [ " CFBundleIcons " ] as? [ String : Any ] ,
246+ let primaryIconsDictionary = iconsDictionary [ " CFBundlePrimaryIcon " ] as? [ String : Any ] ,
242247 let iconFiles = primaryIconsDictionary [ " CFBundleIconFiles " ] as? [ String ] ,
243248 let lastIcon = iconFiles. last else { return nil }
244249 return Image ( named: lastIcon)
@@ -252,7 +257,7 @@ extension Image {
252257 // Resize, we don't need 1024px size
253258 newRep. size = CGSize ( width: 64 , height: 64 )
254259 return newRep. representation ( using: . png, properties: [ : ] )
255- #elseif os(iOS)
260+ #elseif os(iOS) || targetEnvironment(macCatalyst)
256261 // It's already by 64px
257262 return self . pngData ( )
258263 #endif
0 commit comments