<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeveloperToolsSupport",
  "identifier" : "/documentation/DeveloperToolsSupport/LibraryContentProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport22LibraryContentProviderP"
  },
  "title" : "LibraryContentProvider"
}
-->

# LibraryContentProvider

A source of Xcode library and code completion content.

```
protocol LibraryContentProvider
```

## Overview

Xcode discovers implementations of the `LibraryContentProvider` protocol in
your project or workspace and examines their contents for items that it can
add to the Xcode library. Add views by implementing the content provider’s
computed [`views`](/documentation/DeveloperToolsSupport/LibraryContentProvider/views)
property, and returning an array of [`LibraryItem`](/documentation/DeveloperToolsSupport/LibraryItem)
instances initialized with the views you want to publish:

```
struct LibraryViewContent: LibraryContentProvider {
    var views: [LibraryItem] {
        LibraryItem(MyView())
    }
}
```

Add view modifiers by implementing the
[`modifiers(base:)`](/documentation/DeveloperToolsSupport/LibraryContentProvider/modifiers(base:))
method and similarly returning an array of library items initialized with
the modifiers you want to publish. For view modifiers, you also specify the
type to which the modifiers apply:

```
struct LibraryModifierContent: LibraryContentProvider {
    func modifiers(base: MyView) -> [LibraryItem] {
        LibraryItem(base.myModifier(value: MyValue()))
    }
}
```

For modifiers that you define in an extension to
<doc://com.apple.documentation/documentation/SwiftUI/View>, you can provide
any view conformer as the `base`. For modifiers that you define on a
particular view type, provide that type as the `base`.

## Topics

### Adding Views

[`views`](/documentation/DeveloperToolsSupport/LibraryContentProvider/views)

The SwiftUI views that you want to add to the Xcode library.

### Adding Modifiers

[`modifiers(base:)`](/documentation/DeveloperToolsSupport/LibraryContentProvider/modifiers(base:))

Indicates a collection of SwiftUI view modifiers to add to the Xcode
library.

[`ModifierBase`](/documentation/DeveloperToolsSupport/LibraryContentProvider/ModifierBase)

A type to use as a base for modifier completions.

### Building Arrays

[`LibraryContentBuilder`](/documentation/DeveloperToolsSupport/LibraryContentBuilder)

A function builder for generating arrays of library items without
requiring full array literal syntax.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)