Skip to content

tid-kijyun/CatalystAdditions

Repository files navigation

CatalystAdditions

GitHub release Swift Package Manager

CatalystAdditions implements missing features in Mac Catalyst.

⚠️ Using this library may be rejected by AppStore reviews. ⚠️

Requirements

  • Swift 5.1 or later
  • iOS 13.0 or later
  • macOS 10.15 or later

Installation

We can add to your project using Swift Package Manager.

Usage

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

Put NSSearchField in the NSToolbar

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
}
Screenshot

Screen Shot 2019-11-11 at 10 12 44

Setting focus ring to UITextView

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

About

CatalystAdditions implements missing features in Mac Catalyst.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published