Thanks for putting this package together!
I've run into a couple of issues I wanted to make you aware of. [I considered opening a separate issue for the compilation issues, vs. the SPM package search issue - you will probably want to track them separately. But I don't want to clutter your issues list.]
Ambiguous Package Name
When I try loading your package Xcode points to a different package than the url you provided, my guess is that both these packages are being searched for in a non-case-specific way, so they look the same. (CodeMirror-Swift
vs codemirror-swift
)
I specify https://github.com/khoi/codemirror-swift
, but this link appears in Xcode
https://github.com/ProxymanApp/CodeMirror-Swift
- which does not use CodeMirror 6.0
Compilation Errors
I tried using your url inside a Package.swift file in a local package instead [this worked], and the package doesn’t compile due to these errors:
CodeMirrorWebView.swift:39:43: error: cannot find type 'NSRect' in scope
and
CodeMirrorWebView.swift:39:21: error: initializer does not override a designated initializer from its superclass
It looks like these two lines need to conditionally compile based on when using AppKit, vs using UIKit/SwiftUI.
Something like this would solve that:
#if os(OSX)
import AppKit
public typealias NativeRect = NSRect
#elseif os(iOS)
import UIKit
public typealias NativeRect = CGRect
#endif
There's a third issue with the main module, which I haven't researched/resolved, so I'm using a workaround:
CodeMirrorWebView.swift:98:17: error: value of type 'WKWebView' has no member 'allowsMagnification'
Since WKWebView does not have an allowsMagnification
property, I commented it out.
With these errors corrected, the test module fails:
codemirror-swift-main/Tests/CodeMirrorTests/CodeMirrorTests.swift:10:24: error: cannot call value of non-function type 'module<CodeMirror>'
XCTAssertEqual(CodeMirror().text, "Hello, World!")
By commenting out the assertion I did get a successful compile. This is not a final solution but it allows me to try to actually use your package.
I'll let you know how I make out when I swap in your package to my existing app (which uses CodeMirror 5.x).
After making those 3 changes the package successfully compiles