Skip to content

Commit b3d1a83

Browse files
committed
[stdlib] Updated the doc comments for PlaygroundQuickLook/CustomPlaygroundQuickLookable.
Since these are now deprecated (in preparation for removal in a future Swift release), the doc comments reflect that and provide suggestions for what to do instead (i.e. use `CustomPlaygroundDisplayConvertible`) and how to conditionalize usage of `PlaygroundQuickLook`/`CustomPlaygroundQuickLookable` so that source code remains compilable both by old versions which only have the old protocol and newer versions which have removed the old protocol.
1 parent a2aacd7 commit b3d1a83

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

stdlib/public/core/Mirror.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,17 @@ internal extension Mirror {
661661
//===--- QuickLooks -------------------------------------------------------===//
662662

663663
/// The sum of types that can be used as a Quick Look representation.
664+
///
665+
/// - note: `PlaygroundQuickLook` is deprecated, and will be removed from the
666+
/// standard library in a future Swift release. Customizing display for in a
667+
/// playground is now done using the `CustomPlaygroundDisplayConvertible`
668+
/// protocol, which does not use the `PlaygroundQuickLook` enum. Please remove
669+
/// your uses of `PlaygroundQuickLook`, or conditionalize your use such that it
670+
/// is only present when compiling with Swift 4.0 or Swift 3.2 or earlier:
671+
///
672+
/// #if !(swift(>=4.1) || swift(>=3.3) && !swift(>=4.0))
673+
/// /* OK to use PlaygroundQuickLook */
674+
/// #endif
664675
@_fixed_layout // FIXME(sil-serialize-all)
665676
@available(*, deprecated, message: "PlaygroundQuickLook will be removed in a future Swift version. For customizing how types are presented in playgrounds, use CustomPlaygroundDisplayConvertible instead.")
666677
public enum PlaygroundQuickLook {
@@ -775,6 +786,22 @@ extension PlaygroundQuickLook {
775786
/// with the representation supplied for your type by default, you can make it
776787
/// conform to the `CustomPlaygroundQuickLookable` protocol and provide a
777788
/// custom `PlaygroundQuickLook` instance.
789+
///
790+
/// - note: `CustomPlaygroundQuickLookable` is deprecated, and will be removed
791+
/// from the standard library in a future Swift release. Please migrate to the
792+
/// `CustomPlaygroundDisplayConvertible` protocol instead, or conditionalize
793+
/// your conformance such that it is only present when compiling with Swift 4.0
794+
/// or Swift 3.2 or earlier:
795+
///
796+
/// #if swift(>=4.1) || swift(>=3.3) && !swift(>=4.0)
797+
/// // With Swift 4.1 and later (including Swift 3.3 and later), implement
798+
/// // CustomPlaygroundDisplayConvertible.
799+
/// extension MyType: CustomPlaygroundDisplayConvertible { /*...*/ }
800+
/// #else
801+
/// // Otherwise, on Swift 4.0 and Swift 3.2 and earlier,
802+
/// // implement CustomPlaygroundQuickLookable.
803+
/// extension MyType: CustomPlaygroundQuickLookable { /*...*/ }
804+
/// #endif
778805
@available(*, deprecated, message: "CustomPlaygroundQuickLookable will be removed in a future Swift version. For customizing how types are presented in playgrounds, use CustomPlaygroundDisplayConvertible instead.")
779806
public protocol CustomPlaygroundQuickLookable {
780807
/// A custom playground Quick Look for this instance.

0 commit comments

Comments
 (0)