Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Issues Affecting Compilation (Solutions Provided) #2

Closed
Mozahler opened this issue Jun 23, 2022 · 3 comments
Closed

Minor Issues Affecting Compilation (Solutions Provided) #2

Mozahler opened this issue Jun 23, 2022 · 3 comments

Comments

@Mozahler
Copy link

Mozahler commented Jun 23, 2022

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

@khoi
Copy link
Owner

khoi commented Jul 24, 2022

amazing, thanks @Mozahler , care to open a PR to fix those?

@Mozahler
Copy link
Author

I've never done one. Let me find some time to look into it.

@khoi khoi reopened this Jul 28, 2022
@khoi
Copy link
Owner

khoi commented Jul 28, 2022

reopening as this Is not fixed :)

@khoi khoi closed this as completed Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants