Optional

extension Optional
extension Optional where Wrapped: ObjectType
extension Optional where Wrapped: BasicType

可选类安全转换,不为nil

  • Undocumented

    Declaration

    Swift

    public var safeInt: Int { get }
  • Undocumented

    Declaration

    Swift

    public var safeBool: Bool { get }
  • Undocumented

    Declaration

    Swift

    public var safeFloat: Float { get }
  • Undocumented

    Declaration

    Swift

    public var safeDouble: Double { get }
  • Undocumented

    Declaration

    Swift

    public var safeString: String { get }
  • Undocumented

    Declaration

    Swift

    public var safeNumber: NSNumber { get }
  • Undocumented

    Declaration

    Swift

    public var safeArray: [Any] { get }
  • Undocumented

    Declaration

    Swift

    public var safeDictionary: [AnyHashable : Any] { get }
  • Undocumented

    Declaration

    Swift

    public var isNil: Bool { get }
  • Undocumented

    Declaration

    Swift

    public static func isNil(_ value: Wrapped?) -> Bool
  • Undocumented

    Declaration

    Swift

    public static func isOptional(_ value: Any) -> Bool
  • Undocumented

    Declaration

    Swift

    public static func deepUnwrap(_ value: Any) -> Any?
  • Undocumented

    Declaration

    Swift

    public func then<T>(_ block: (Wrapped) throws -> T?) rethrows -> T?
  • Undocumented

    Declaration

    Swift

    public func filter(_ predicate: (Wrapped) -> Bool) -> Wrapped?
  • Undocumented

    Declaration

    Swift

    public func or(_ defaultValue: @autoclosure () -> Wrapped, _ block: ((Wrapped) -> Wrapped)? = nil) -> Wrapped

Available where Wrapped: ObjectType

  • Undocumented

    Declaration

    Swift

    public var safeValue: Wrapped { get }

Available where Wrapped: BasicType

  • Undocumented

    Declaration

    Swift

    public var isNotEmpty: Bool { get }