Xcode Library Customization

Expose custom views and modifiers in the Xcode library.

Overview 概要

You can add your custom SwiftUI views and view modifiers to Xcode’s Library. This allows anyone developing your app or adopting your framework to access them by clicking the Library button (+) in Xcode’s toolbar. You can select and drag the custom library items into code, just like you would for system-provided items.

To add items to the Library, create a structure that conforms to the LibraryContentProvider protocol and encapsulate any items you want to add as LibraryItem instances. Implement the views computed property to add library items containing views. Implement the modifiers(base:) method to add items containing view modifiers. Xcode harvests items from all of the library content providers in your project as you work, and makes them available to you in its Library.

Topics 話題

Library Items

See Also 参照

Tool Support