檔案結構
一個 .playgroundbook 本身有特殊的檔案結構,如果內容結構不正確或其屬性列表檔 (.plist) 不正確,都可能造成 .playgroundbook 無法開啟的現象。
每個 playground book 都有一個 .playgroundbook/Contents/Manifest.plist 檔案,裡面記錄了這個 playground book 的檔案結構。 ➡️ 範例:💾 Manifest.plist
Manifest.plist
Key
Required
Type
Value
Note
UserModuleMode
✅
String
FullLimitedDisabled
UserAutoImportedAuxiliaryModules
❓
Array
❓
開啟時自動匯入的模組 ❓
UserModuleMode
這個鍵值 (key) 決定使用者能不能使用模組:一個沒有 UserModule 的 playground book,用 Disabled,而有 UserModule 的,用 Full 或 Limited:
<key>UserModuleMode</key>
<string>Disabled</string><key>UserModuleMode</key>
<string>Full</string>UserAutoImportedAuxiliaryModules
這個鍵值 (key) 決定開啟檔案時,會自動匯入哪些模組。空白範本沒有自動匯入任何模組,所以用 <array/>,:而「學習程式設計 2」會自動匯入 .playground/Contents/Modules/Book.playgroundmodule,請看下面的「Learn to Code 2」頁面。
<key>UserAutoImportedAuxiliaryModules</key>
<array/><key>UserAutoImportedAuxiliaryModules</key>
<array>
<string>Book</string>
</array>📘 參考資料
Last updated
Was this helpful?