Errors when using in macOS SwiftUI app

#15 · closed · 3 comments

View on GitHub ↗

mainrs

Hey! I've added the package to my macOS app that uses SwiftUI as per the instructions in the readme file. I do, however, get error messages when I try to build the application. This is a screenshot of the `SwiftlySearch.swift` file that shows up when I click on one of the 38 errors that I get: <img width="854" alt="Screenshot 2021-06-11 at 14 13 46" src="https://user-images.githubusercontent.com/5113257/121684684-4b8c9200-cabf-11eb-8dab-f8cd245515ed.png"> My project is set to `macOS 11.3` as its target. Any idea what is going on?

Comments

thislooksfun

Is this a Mac Catalyst app, or native macOS?

mainrs

It's a native macOS app. I just noticed that you rely on `UIKit` and macOS would need `AppKit`. That explains why it doesn't compile properly.

thislooksfun

Yeah, unfortunately SwiftlySearch only works on iOS and probably with Catalyst (though I haven't tested it yet). If you can wait until Monterrey you can use the new .searchable(), which is fully cross-platform. Until then you'll probably have to roll your own.