Files

31 lines
1.1 KiB
Swift
Raw Permalink Normal View History

//
// Optional+Literal.swift
// JSONAPITesting
//
// Created by Mathew Polzin on 11/29/18.
//
extension Optional: ExpressibleByUnicodeScalarLiteral where Wrapped: ExpressibleByUnicodeScalarLiteral {
2019-11-05 22:37:48 -08:00
public typealias UnicodeScalarLiteralType = Wrapped.UnicodeScalarLiteralType
2019-11-05 22:37:48 -08:00
public init(unicodeScalarLiteral value: UnicodeScalarLiteralType) {
self = .some(Wrapped(unicodeScalarLiteral: value))
}
}
extension Optional: ExpressibleByExtendedGraphemeClusterLiteral where Wrapped: ExpressibleByExtendedGraphemeClusterLiteral {
2019-11-05 22:37:48 -08:00
public typealias ExtendedGraphemeClusterLiteralType = Wrapped.ExtendedGraphemeClusterLiteralType
2019-11-05 22:37:48 -08:00
public init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterLiteralType) {
self = .some(Wrapped(extendedGraphemeClusterLiteral: value))
}
}
extension Optional: ExpressibleByStringLiteral where Wrapped: ExpressibleByStringLiteral {
2019-11-05 22:37:48 -08:00
public typealias StringLiteralType = Wrapped.StringLiteralType
2019-11-05 22:37:48 -08:00
public init(stringLiteral value: StringLiteralType) {
self = .some(Wrapped(stringLiteral: value))
}
}