> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swift-playgrounds/structures.md).

# 檔案結構

一個 .playgroundbook 本身有特殊的檔案結構，如果內容結構不正確或其屬性列表檔 (.plist) 不正確，都可能造成 .playgroundbook 無法開啟的現象。

每個 playground book 都有一個 `.playgroundbook/Contents/Manifest.plist` 檔案，裡面記錄了這個 playground book 的檔案結構。 :arrow\_right: 範例：[💾 Manifest.plist](/ios/swift-playgrounds/structures/manifest.plist.md)

## Manifest.plist

| Key                                  | Required             | Type   | Value                                                                                          | Note                  |
| ------------------------------------ | -------------------- | ------ | ---------------------------------------------------------------------------------------------- | --------------------- |
| **UserModuleMode**                   | :white\_check\_mark: | String | <ul><li><code>Full</code></li><li><code>Limited</code></li><li><code>Disabled</code></li></ul> |                       |
| **UserAutoImportedAuxiliaryModules** | :question:           | Array  | :question:                                                                                     | 開啟時自動匯入的模組 :question: |

### UserModuleMode

這個鍵值 (key) 決定使用者能不能[使用模組](/ios/swift-playgrounds/modules.md)：一個沒有 `UserModule` 的 playground book，用 `Disabled`，而有 `UserModule` 的，用 `Full` 或 `Limited`：

{% tabs %}
{% tab title="Disabled" %}

```markup
<key>UserModuleMode</key>
<string>Disabled</string>
```

{% endtab %}

{% tab title="Full" %}

```markup
<key>UserModuleMode</key>
<string>Full</string>
```

{% endtab %}
{% endtabs %}

### UserAutoImportedAuxiliaryModules

這個鍵值 (key) 決定開啟檔案時，會**自動匯入**哪些模組。**空白範本**沒有自動匯入任何模組，所以用 `<array/>`，：而「[學習程式設計 2](/ios/swift-playgrounds/learn-to-code-2.md)」會自動匯入 `.playground/Contents/Modules/Book.playgroundmodule`，請看下面的「Learn to Code 2」頁面。

{% tabs %}
{% tab title="Blank" %}

```markup
<key>UserAutoImportedAuxiliaryModules</key>
<array/>
```

{% endtab %}

{% tab title="Learn to Code 2" %}

```markup
<key>UserAutoImportedAuxiliaryModules</key>
<array>
		<string>Book</string>
</array>
```

{% endtab %}
{% endtabs %}

## 📘 參考資料

1. [Structuring Content for Swift Playgrounds](https://developer.apple.com/documentation/swift_playgrounds/structuring_content_for_swift_playgrounds)
