實例方法
suggested
suggestedFileName(_:)
如果接收者選擇將項目寫入磁盤,則提供要使用的文件名。
聲明
func suggestedFileName(_ fileName: String) -> some TransferRepresentation
參數
fileName
建議的文件名,包括文件擴展名。
詳述
任何傳輸表示都可以寫入磁盤。
extension ImageDocumentLayer: Transferable {
static var transferRepresentation: some TransferRepresentation {
DataRepresentation(contentType: .layer) { layer in
layer.data()
} importing: { data in
try ImageDocumentLayer(data: data)
}
.suggestedFileName("Layer.exampleLayer")
DataRepresentation(exportedContentType: .png) { layer in
layer.pngData()
}
.suggestedFileName("Layer.png")
}
}
上麵的 .exampleLayer 文件擴展名應與您在應用程序的 Info.plist
文件中聲明的 layer
內容類型的擴展名匹配。
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相關用法
- Swift Never submitScope(_:)用法及代碼示例
- Swift Never submitLabel(_:)用法及代碼示例
- Swift Never saturation(_:)用法及代碼示例
- Swift Never simultaneousGesture(_:including:)用法及代碼示例
- Swift Never symbolVariant(_:)用法及代碼示例
- Swift Never scaledToFill()用法及代碼示例
- Swift Never safeAreaInset(edge:alignment:spacing:content:)用法及代碼示例
- Swift Never searchCompletion(_:)用法及代碼示例
- Swift Never sheet(isPresented:onDismiss:content:)用法及代碼示例
- Swift Never scaleEffect(x:y:anchor:)用法及代碼示例
- Swift Never speechAlwaysIncludesPunctuation(_:)用法及代碼示例
- Swift Never sheet(item:onDismiss:content:)用法及代碼示例
- Swift Never scaleEffect(_:anchor:)用法及代碼示例
- Swift Never scaledToFit()用法及代碼示例
- Swift Never shadow(color:radius:x:y:)用法及代碼示例
- Swift Never swipeActions(edge:allowsFullSwipe:content:)用法及代碼示例
- Swift Never scenePadding(_:)用法及代碼示例
- Swift Never pageCommand(value:in:step:)用法及代碼示例
- Swift Never opacity(_:)用法及代碼示例
- Swift Never colorMultiply(_:)用法及代碼示例
- Swift Never accessibilityAction(action:label:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:message:)用法及代碼示例
- Swift Never confirmationDialog(_:isPresented:titleVisibility:actions:)用法及代碼示例
- Swift Never flipsForRightToLeftLayoutDirection(_:)用法及代碼示例
- Swift Never position(x:y:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Never suggestedFileName(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。