ZeeZide / CodeEditor

A SwiftUI TextEditor with syntax highlighting using Highlight.js
MIT License
449 stars 57 forks source link

Not compiling on ios due to use of NSColor #36

Open SoylentGraham opened 1 week ago

SoylentGraham commented 1 week ago

Seems like all the backgroundColor:NSColor variables can be replaced with SwiftUI.Color and then at the end a cross platform alias

#if os(macOS)
  import AppKit

  typealias UXTextView          = NSTextView
  typealias UXTextViewDelegate  = NSTextViewDelegate
  typealias UColor              = NSColor
#else
  import UIKit

  typealias UXTextView          = UITextView
  typealias UXTextViewDelegate  = UITextViewDelegate
  typealias UColor              = UIColor
#endif
SoylentGraham commented 1 week ago

Note to self, use #if canImport(UIKit) not os()