Skip to content

Commit caa3a2a

Browse files
authored
Merge pull request #1764 from tkremenek/CustomPlaygroundDisplayConvertible-swift5
Conform URL, NSRange, and Date to CustomPlaygroundDisplayConvertible.
2 parents 0a42c27 + 073732d commit caa3a2a

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

Foundation/Date.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,18 +254,13 @@ extension Date : _ObjectiveCBridgeable {
254254
}
255255
}
256256

257-
extension Date : CustomPlaygroundQuickLookable {
258-
var summary: String {
257+
extension Date : CustomPlaygroundDisplayConvertible {
258+
public var playgroundDescription: Any {
259259
let df = DateFormatter()
260260
df.dateStyle = .medium
261261
df.timeStyle = .short
262262
return df.string(from: self)
263263
}
264-
265-
@available(*, deprecated, message: "Date.customPlaygroundQuickLook will be removed in a future Swift version")
266-
public var customPlaygroundQuickLook: PlaygroundQuickLook {
267-
return .text(summary)
268-
}
269264
}
270265

271266
extension Date : Codable {

Foundation/NSRange.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,9 @@ extension NSRange : CustomReflectable {
309309
}
310310
}
311311

312-
extension NSRange : CustomPlaygroundQuickLookable {
313-
@available(*, deprecated, message: "NSRange.customPlaygroundQuickLook will be removed in a future Swift version")
314-
public var customPlaygroundQuickLook: PlaygroundQuickLook {
315-
return .range(Int64(location), Int64(length))
312+
extension NSRange : CustomPlaygroundDisplayConvertible {
313+
public var playgroundDescription: Any {
314+
return (Int64(location), Int64(length))
316315
}
317316
}
318317

Foundation/URL.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -991,10 +991,9 @@ extension URL : CustomStringConvertible, CustomDebugStringConvertible {
991991
}
992992
}
993993

994-
extension URL : CustomPlaygroundQuickLookable {
995-
@available(*, deprecated, message: "URL.customPlaygroundQuickLook will be removed in a future Swift version")
996-
public var customPlaygroundQuickLook: PlaygroundQuickLook {
997-
return .url(absoluteString)
994+
extension URL : CustomPlaygroundDisplayConvertible {
995+
public var playgroundDescription: Any {
996+
return absoluteString
998997
}
999998
}
1000999

0 commit comments

Comments
 (0)