File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Sources/ComposableRequest/Wrapper Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,18 @@ import CoreGraphics
1212#endif
1313
1414/// A `protocol` allowing to `init` `Wrapper`s.
15- public protocol Wrappable {
15+ public protocol Wrappable : CustomStringConvertible {
1616 /// Wrap `self` into a `Wrapper`.
1717 var wrapped : Wrapper { get }
1818}
1919
20+ public extension Wrappable {
21+ /// The description.
22+ ///
23+ /// - note: Override this for custom behavior.
24+ var description : String { wrapped. description }
25+ }
26+
2027extension Bool : Wrappable {
2128 /// Wrap `self` into a `Wrapper`.
2229 public var wrapped : Wrapper { . init( booleanLiteral: self ) }
@@ -47,6 +54,13 @@ extension NSNull: Wrappable {
4754 public var wrapped : Wrapper { . empty }
4855}
4956
57+ extension Optional : CustomStringConvertible where Wrapped: Wrappable {
58+ /// The description.
59+ ///
60+ /// - note: Override this for custom behavior.
61+ public var description : String { self ? . description ?? " <empty> " }
62+ }
63+
5064extension Optional : Wrappable where Wrapped: Wrappable {
5165 /// Wrap `self` into a `Wrapper`.
5266 public var wrapped : Wrapper { flatMap { $0. wrapped } ?? . empty }
You can’t perform that action at this time.
0 commit comments