當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Swift Mirror.AncestorRepresentation.customized(_:)用法及代碼示例

案子

Mirror.AncestorRepresentation.customized(_:)

使用最近祖先的customMirror 實現為該祖先創建鏡像。

聲明

case customized(() -> Mirror)

詳述

從這樣的祖先派生的其他類被賦予默認鏡像。此選項的有效負載應始終為 { super.customMirror }


var customMirror: Mirror {
    return Mirror(
        self,
        children: ["someProperty": self.someProperty],
        ancestorRepresentation: .customized({ super.customMirror })) // <==
}

可用版本

iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+

相關用法


注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Mirror.AncestorRepresentation.customized(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。