Skip to content

Commit

Permalink
Color wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Mar 29, 2024
1 parent 7a96db5 commit 57fe857
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/NSUI/Color.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import SwiftUI

extension Color {
@available(macOS 12.0, *)
public init(nsuiColor: NSUIColor) {
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
self.init(nsColor: nsuiColor)
#elseif canImport(UIKit)
self.init(uiColor: nsuiColor)
#endif
}
}
10 changes: 10 additions & 0 deletions Tests/NSUITests/ColorTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import SwiftUI
import XCTest

import NSUI

final class ColorTests: XCTestCase {
func testInit() {
let _ = Color(nsuiColor: NSUIColor.red)
}
}

0 comments on commit 57fe857

Please sign in to comment.