Last active
September 23, 2018 02:11
-
-
Save tomaskraina/a1f79b27b8b1698cd2211ee6ff18bce0 to your computer and use it in GitHub Desktop.
NSUserActivity+CustomReflectable extension so an user activity can be po-ed in lldb / Xcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSUserActivity+CustomReflectable.swift | |
// Tom Kraina <[email protected]> | |
// | |
// Created by Tom Kraina on 19/11/2016. | |
// Copyright © 2016 Tom Kraina <[email protected]>. All rights reserved. | |
// | |
import Foundation | |
// Inspired by: | |
// - https://medium.com/@darjeelingsteve/easier-swift-debugging-with-mirrors-3b6e551f3c47 | |
// MARK: - CustomReflectable | |
extension NSUserActivity : CustomReflectable { | |
public func customMirror() -> Mirror { | |
let children = DictionaryLiteral<String, Any>(dictionaryLiteral: | |
("activityType", activityType), | |
("title", title), | |
("userInfo", userInfo.debugDescription), | |
("requiredUserInfoKeys", requiredUserInfoKeys), | |
("needsSave", needsSave), | |
("webpageURL", webpageURL), | |
("expirationDate", expirationDate.debugDescription), | |
("keywords", keywords), | |
("supportsContinuationStreams", supportsContinuationStreams), | |
("delegate", delegate), | |
("eligibleForHandoff", eligibleForHandoff), | |
("eligibleForSearch", eligibleForSearch), | |
("eligibleForPublicIndexing", eligibleForPublicIndexing)) | |
return Mirror(NSUserActivity.self, children: children, displayStyle: .Class, ancestorRepresentation: .Suppressed) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: