Add InsForge to your Swift Package Manager dependencies:
Enable Logging (Optional)
For debugging, you can configure the SDK log level and destination:
Log Levels:
| Level | Description |
|---|
.trace | Most verbose, includes all internal details |
.debug | Detailed information for debugging |
.info | General operational information (default) |
.warning | Warnings that don’t prevent operation |
.error | Errors that affect functionality |
.critical | Critical failures |
Log Destinations:
| Destination | Description |
|---|
.console | Standard output (print) |
.osLog | Apple’s unified logging system (recommended for iOS/macOS) |
.none | Disable logging |
.custom | Provide your own LogHandler factory |
Use .info or .error in production to avoid exposing sensitive data in logs.
from()
取得儲存體桶的檔案 API 參考。
儲存體桶操作
createBucket()
建立新的儲存體桶。
listBuckets()
列出所有儲存體桶名稱。
updateBucket()
更新儲存體桶的可見性。
deleteBucket()
刪除儲存體桶。
upload()
上傳檔案到儲存體桶。
path (String) - 檔案的物件鍵/路徑
data (Data) - 要上傳的檔案資料
options (FileOptions, optional) - 上傳選項,包括 contentType
download()
下載檔案為資料。
list()
列出儲存體桶中的檔案。
options (ListOptions, optional) - 選項,包括前置詞、限制、位移
delete()
從儲存體刪除檔案。
getPublicURL()
取得公共儲存體桶中檔案的公開 URL。
上傳策略
取得大型檔案的上傳策略(直接或預簽署 URL)。
getUploadStrategy()
confirmUpload()
在上傳到 S3 後確認預簽署上傳。
下載策略
取得私人檔案的下載策略(直接或預簽署 URL)。
getDownloadStrategy()
選項參考
FileOptions
檔案上傳操作的選項。
BucketOptions
儲存體桶建立/更新的選項。
ListOptions
列出檔案的選項。
StoredFile 模型
儲存體操作的回應模型。