Skip to content

Commit

Permalink
Merge pull request #161 from heoblitz/main
Browse files Browse the repository at this point in the history
Add UIKit component support
  • Loading branch information
sahara-ooga authored Sep 29, 2021
2 parents 67d448d + b89b9e3 commit f4d9fa5
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Sources/Core/PrettyDescriber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
// Copyright (c) 2020 Yusuke Hosonuma.
//

import Foundation
#if canImport(UIKit)
import UIKit
typealias UIComponent = UIResponder
#else
import Foundation
typealias UIComponent = AnyClass
#endif

struct PrettyDescriber {
var formatter: PrettyFormatter
Expand Down Expand Up @@ -175,15 +181,25 @@ struct PrettyDescriber {
return value.debugDescription

case let value as CustomStringConvertible:
return value.description
if #available(iOS 10.0, tvOS 10.0, *),
let _ = value as? UIComponent {
return nil
} else {
return value.description
}

default:
return nil
}
} else {
switch target {
case let value as CustomStringConvertible:
return value.description
if #available(iOS 10.0, tvOS 10.0, *),
let _ = value as? UIComponent {
return nil
} else {
return value.description
}

case let value as CustomDebugStringConvertible:
return value.debugDescription
Expand Down

0 comments on commit f4d9fa5

Please sign in to comment.