eleven / messenger Public

Clone
git clone https://amadan.net/eleven/messenger

Plain git — no account needed to clone.

Download

Download this file

1import SwiftUI
2
3// The one sanctioned platform seam in LChatCore (the NetNewsWire RSImage
4// trick, anticipated in docs/native-chat.md): a decoded image is NSImage on
5// the Mac and UIImage everywhere else, so image-handling code stays shared
6// without the core growing real AppKit/UIKit dependencies.
7#if canImport(AppKit) && !targetEnvironment(macCatalyst)
8import AppKit
9public typealias PlatformImage = NSImage
10public typealias PlatformFont = NSFont
11#else
12import UIKit
13public typealias PlatformImage = UIImage
14public typealias PlatformFont = UIFont
15#endif
16
17public extension Image {
18 init(platform image: PlatformImage) {
19 #if canImport(AppKit) && !targetEnvironment(macCatalyst)
20 self.init(nsImage: image)
21 #else
22 self.init(uiImage: image)
23 #endif
24 }
25}
26