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 }
  • int

    Undocumented

    Declaration

    Swift

    public var int: Int? { get }
  • Undocumented

    Declaration

    Swift

    public var bool: Bool? { get }
  • Undocumented

    Declaration

    Swift

    public var float: Float? { get }
  • Undocumented

    Declaration

    Swift

    public var double: Double? { get }
  • Undocumented

    Declaration

    Swift

    public var string: String? { get }
  • Undocumented

    Declaration

    Swift

    public var number: NSNumber? { get }
  • Undocumented

    Declaration

    Swift

    public var array: [Any]? { get }
  • Undocumented

    Declaration

    Swift

    public var dictionary: [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) -> Wrapped
  • Undocumented

    Declaration

    Swift

    public func or(_ defaultValue: @autoclosure () -> Wrapped, _ block: (Wrapped) -> Wrapped) -> 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 }