Array

extension Array: ArrayParameter
extension Array: BasicType
extension Array: WrapperCompatible
extension Array: AnyModel
extension Array where Element: Equatable
extension Array where Element: AnyModel
extension Array where Element: JSONModel
extension Array where Element: SmartModel
extension Array where Element: SmartDecodable
extension Array where Element: SmartEncodable
extension Array where Element: AnyArchivable
extension Array where Element: WebSocketArrayType & UnsignedInteger
  • Undocumented

    Declaration

    Swift

    public var arrayValue: [Element] { get }

ObjectType+Extension

  • Undocumented

    Declaration

    Swift

    public var isNotEmpty: Bool { get }
  • Undocumented

    Declaration

    Swift

    public func safeElement(_ index: Int) -> Element?
  • Undocumented

    Declaration

    Swift

    public subscript(safe index: Int) -> Element? { get }
  • Undocumented

    Declaration

    Swift

    public mutating func safeSwap(from index: Index, to otherIndex: Index)

Foundation+AnyDecoder

  • Undocumented

    Declaration

    Swift

    public func decoded<T>(using decoder: JSONDecoder = JSONDecoder(), as type: T.Type = T.self) throws -> T where T : Decodable

Available where Element: Equatable

  • Undocumented

    Declaration

    Swift

    @discardableResult
    public mutating func removeAll(_ item: Element) -> [Element]
  • Undocumented

    Declaration

    Swift

    @discardableResult
    public mutating func removeAll(_ items: [Element]) -> [Element]

Available where Element: AnyModel

  • 从Object解码成可选Model数组,当object为字典和数组时支持具体路径

    Declaration

    Swift

    public static func decodeModel(from object: Any?, designatedPath: String? = nil) -> `Self`?
  • 从Object安全解码成Model数组,当object为字典和数组时支持具体路径

    Declaration

    Swift

    public static func decodeSafeModel(from object: Any?, designatedPath: String? = nil) -> Array<Element>
  • 从数组Model编码成Object

    Declaration

    Swift

    public func encodeObject() -> Any?

Available where Element: JSONModel

  • 默认实现从Object解码成可选Model数组,当object为字典和数组时支持具体路径

    Declaration

    Swift

    public static func decodeModel(from object: Any?, designatedPath: String? = nil) -> `Self`?
  • 从数组Model编码成Object

    Declaration

    Swift

    public func encodeObject() -> Any?

Available where Element: SmartModel

  • 默认实现从Object解码成可选Model数组,当object为字典和数组时支持具体路径

    Declaration

    Swift

    public static func decodeModel(from object: Any?, designatedPath: String? = nil) -> `Self`?
  • 从数组Model编码成Object

    Declaration

    Swift

    public func encodeObject() -> Any?

Available where Element: JSONModel

  • if the JSON field finded by designatedPath in json is representing a array, such as [{...}, {...}, {...}], this method converts it to a Models array

    Declaration

    Swift

    public static func deserialize(from json: String?, designatedPath: String? = nil) -> [Element?]?
  • deserialize model array from dictionary

    Declaration

    Swift

    public static func deserialize(from dict: [AnyHashable : Any]?, designatedPath: String? = nil) -> [Element?]?
  • deserialize model array from array

    Declaration

    Swift

    public static func deserialize(from array: [Any]?, designatedPath: String? = nil) -> [Element?]?
  • deserialize model array from object

    Declaration

    Swift

    public static func deserializeAny(from object: Any?, designatedPath: String? = nil) -> [Element]?
  • safe deserialize model array from array

    Declaration

    Swift

    public static func safeDeserialize(from array: [Any]?, designatedPath: String? = nil) -> [Element]
  • if the JSON field finded by designatedPath in json is representing a array, such as [{...}, {...}, {...}], this method safe converts it to a Models array

    Declaration

    Swift

    public static func safeDeserialize(from string: String?, designatedPath: String? = nil) -> [Element]
  • safe deserialize model array from dictionary

    Declaration

    Swift

    public static func safeDeserialize(from dict: [AnyHashable : Any]?, designatedPath: String? = nil) -> [Element]
  • safe deserialize model array from object

    Declaration

    Swift

    public static func safeDeserializeAny(from object: Any?, designatedPath: String? = nil) -> [Element]

Available where Element: SmartDecodable

  • Undocumented

    Declaration

    Swift

    public static func deserializeAny(from object: Any?, designatedPath: String? = nil, options: Set<SmartDecodingOption>? = nil) -> [Element]?
  • Deserializes into an array of models

    Declaration

    Swift

    public static func deserialize(from array: [Any]?, designatedPath: String? = nil, options: Set<SmartDecodingOption>? = nil) -> [Element]?

    Parameters

    array

    Array

    designatedPath

    Specifies the data path to decode

    options

    Decoding strategy Duplicate enumeration items are not allowed, e.g., multiple keyStrategies cannot be passed in [only the first one is effective].

    Return Value

    Array of models

  • Deserializes into an array of models

    Declaration

    Swift

    public static func deserialize(from json: String?, designatedPath: String? = nil, options: Set<SmartDecodingOption>? = nil) -> [Element]?

    Parameters

    json

    JSON string

    designatedPath

    Specifies the data path to decode

    options

    Decoding strategy Only one enumeration item is allowed, e.g., multiple keyStrategies cannot be passed in [only the first one is effective].

    Return Value

    Array of models

  • Deserializes into an array of models

    Declaration

    Swift

    public static func deserialize(from data: Data?, designatedPath: String? = nil, options: Set<SmartDecodingOption>? = nil) -> [Element]?

    Parameters

    data

    Data

    designatedPath

    Specifies the data path to decode

    options

    Decoding strategy Duplicate enumeration items are not allowed, e.g., multiple keyStrategies cannot be passed in [only the first one is effective].

    Return Value

    Array of models

  • Deserializes into an array of models

    Declaration

    Swift

    public static func deserializePlist(from data: Data?, designatedPath: String? = nil, options: Set<SmartDecodingOption>? = nil) -> [Element]?

    Parameters

    data

    Data

    designatedPath

    Specifies the data path to decode

    options

    Decoding strategy Duplicate enumeration items are not allowed, e.g., multiple keyStrategies cannot be passed in [only the first one is effective].

    Return Value

    Array of models

Available where Element: SmartEncodable

  • Serializes into a array

    Declaration

    Swift

    public func toArray(options: Set<SmartEncodingOption>? = nil) -> [Any]?

    Parameters

    useMappedKeys

    Whether to use the mapped key during encoding. The default value is false.

    Return Value

    array

  • Serializes into a JSON string

    Declaration

    Swift

    public func toJSONString(options: Set<SmartEncodingOption>? = nil, prettyPrint: Bool = false) -> String?

    Parameters

    useMappedKeys

    Whether to use the mapped key during encoding. The default value is false.

    options

    encoding options

    prettyPrint

    Whether to format print (adds line breaks in the JSON)

    Return Value

    JSON string

Available where Element: AnyArchivable

  • 将Data数据解码为对象数组,不调用NSKeyedUnarchiver

    Declaration

    Swift

    public static func archiveDecode(_ data: Data?) -> `Self`?
  • 将Data数据解码为安全对象数组,不调用NSKeyedUnarchiver

    Declaration

    Swift

    public static func archiveDecodeSafe(_ data: Data?) -> Array<Element>
  • 将对象数组编码为Data数据,不调用NSKeyedArchiver

    Declaration

    Swift

    public func archiveEncode() -> Data?

Available where Element: WebSocketArrayType & UnsignedInteger

  • Read a UInt16 from a buffer.

    Declaration

    Swift

    public func readUint16(offset: Int) -> UInt16

    Parameters

    offset

    is the offset index to start the read from (e.g. buffer[0], buffer[1], etc).

    Return Value

    a UInt16 of the value from the buffer

  • Read a UInt64 from a buffer.

    Declaration

    Swift

    public func readUint64(offset: Int) -> UInt64

    Parameters

    offset

    is the offset index to start the read from (e.g. buffer[0], buffer[1], etc).

    Return Value

    a UInt64 of the value from the buffer

  • Undocumented

    Declaration

    Swift

    public func unmaskData(maskStart: Int, offset: Int, length: Int) -> Data