CatalystAdditions implements missing features in Mac Catalyst.
- Swift 5.1 or later
- iOS 13.0 or later
- macOS 10.15 or later
We can add to your project using Swift Package Manager.
All relevant code must be enclosed in a preprocessor, as shown below:
#if targetEnvironment(macCatalyst)
import CatalystAdditions
#endif
#if targetEnvironment(macCatalyst)
// use module APIs
#endif
let item = SearchToolbarItem(itemIdentifier: .search) { text in
// do something
}
let item = SearchToolbarItem(itemIdentifier: .search, textChanged: { (textChanged) in
// update search results as the user is typing
}) { (textReturned) in
// update search results only after return/enter key is pressed
}
In the current Catalyst, UITextView cannot set the focus ring. By default, the focus ring is displayed.
let textView: UITextView // A properly initialized TextView
textView.focusRingType = .none