Array
extension Array: AnyModel
extension Array: ArrayParameter
extension Array: BasicType
extension Array: WrapperCompatible
extension Array where Element: SmartModel
extension Array where Element: SmartDecodable
extension Array: SmartCodable where Element: SmartCodable
extension Array where Element: SmartEncodable
extension Array where Element: AnyModel
extension Array where Element: AnyArchivable
extension Array where Element: Equatable
extension Array where Element: MappableModel
extension Array where Element: WebSocketArrayType & UnsignedInteger
-
Undocumented
Declaration
Swift
public func decoded<T>(using decoder: JSONDecoder = JSONDecoder(), as type: T.Type = T.self) throws -> T where T : Decodable
-
Undocumented
Declaration
Swift
public var arrayValue: [Element] { get }
-
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 }
-
默认实现从Object解码成可选Model数组,当object为字典和数组时支持具体路径
Declaration
Swift
public static func decodeModel(from object: Any?, designatedPath: String? = nil) -> `Self`?
-
从数组Model编码成Object
Declaration
Swift
public func encodeObject() -> Any?
-
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
-
Serializes into a array
Declaration
Swift
public func toArray(options: Set<SmartEncodingOption>? = nil) -> [Any]?
Return Value
array
-
Serializes into a JSON string
Declaration
Swift
public func toJSONString(options: Set<SmartEncodingOption>? = nil, prettyPrint: Bool = false) -> String?
Parameters
options
encoding options
prettyPrint
Whether to format print (adds line breaks in the JSON)
Return Value
JSON string
-
从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?
-
将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?
-
Undocumented
Declaration
Swift
@discardableResult public mutating func removeAll(_ item: Element) -> [Element]
-
Undocumented
Declaration
Swift
@discardableResult public mutating func removeAll(_ items: [Element]) -> [Element]
-
默认实现从Object解码成可选Model数组,当object为字典和数组时支持具体路径
Declaration
Swift
public static func decodeModel(from object: Any?, designatedPath: String? = nil) -> `Self`?
-
从数组Model编码成Object
Declaration
Swift
public func encodeObject() -> Any?
-
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