NSData(FWFoundation)

@interface NSData (FWFoundation)

/// 使用NSKeyedUnarchiver解压数据
- (nullable id)fw_unarchiveObject:(Class)clazz NS_REFINED_FOR_SWIFT;

/// 使用NSKeyedArchiver压缩对象
+ (nullable NSData *)fw_archiveObject:(id)object NS_REFINED_FOR_SWIFT;

/// 保存对象归档
+ (BOOL)fw_archiveObject:(id)object toFile:(NSString *)path NS_REFINED_FOR_SWIFT;

/// 读取对象归档
+ (nullable id)fw_unarchiveObject:(Class)clazz withFile:(NSString *)path NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 使用NSKeyedUnarchiver解压数据

    Declaration

    Objective-C

    - (nullable id)fw_unarchiveObject:(nonnull Class)clazz;
  • 使用NSKeyedArchiver压缩对象

    Declaration

    Objective-C

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

    Declaration

    Objective-C

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

    Declaration

    Objective-C

    + (nullable id)fw_unarchiveObject:(nonnull Class)clazz
                             withFile:(nonnull NSString *)path;