FWDataClassWrapper

@interface FWDataClassWrapper : FWClassWrapper

Undocumented

Json

  • Foundation对象编码为json数据

    Declaration

    Objective-C

    - (nullable NSData *)jsonEncode:(nonnull id)object;

    Parameters

    object

    编码对象

    Return Value

    json数据

FWFoundation

  • 使用NSKeyedArchiver压缩对象

    Declaration

    Objective-C

    - (nullable NSData *)archiveObject:(nonnull id)object;
  • 保存对象归档

    Declaration

    Objective-C

    - (BOOL)archiveObject:(nonnull id)object toFile:(nonnull NSString *)path;
  • 读取对象归档

    Declaration

    Objective-C

    - (nullable id)unarchiveObject:(nonnull Class)clazz
                          withFile:(nonnull NSString *)path;

FWAnimated

  • 获取图片数据的格式,未知格式返回FWImageFormatUndefined

    Declaration

    Objective-C

    - (FWImageFormat)imageFormatForImageData:(nullable NSData *)data;
  • 图片格式转化为UTType,未知格式返回kUTTypeImage

    Declaration

    Objective-C

    - (nonnull CFStringRef)UTTypeFromImageFormat:(FWImageFormat)format;
  • UTType转化为图片格式,未知格式返回FWImageFormatUndefined

    Declaration

    Objective-C

    - (FWImageFormat)imageFormatFromUTType:(nonnull CFStringRef)uttype;
  • 图片格式转化为mimeType,未知格式返回application/octet-stream

    Declaration

    Objective-C

    - (nonnull NSString *)mimeTypeFromImageFormat:(FWImageFormat)format;
  • 文件后缀转化为mimeType,未知后缀返回application/octet-stream

    Declaration

    Objective-C

    - (nonnull NSString *)mimeTypeFromExtension:(nonnull NSString *)extension;
  • 图片数据编码为base64字符串,可直接用于H5显示等,字符串格式:data:image/png;base64,数据

    Declaration

    Objective-C

    - (nullable NSString *)base64StringForImageData:(nullable NSData *)data;