High performance model framework for iOS/OSX.

Related tags

JSON YYModel
Overview

YYModel

License MIT  Carthage compatible  CocoaPods  CocoaPods  Build Status  codecov.io

High performance model framework for iOS/OSX.
(It's a component of YYKit)

Performance

Time cost (process GithubUser 10000 times on iPhone 6):

Benchmark result

See Benchmark/ModelBenchmark.xcodeproj for more benchmark case.

Features

  • High performance: The conversion performance is close to handwriting code.
  • Automatic type conversion: The object types can be automatically converted.
  • Type Safe: All data types will be verified to ensure type-safe during the conversion process.
  • Non-intrusive: There is no need to make the model class inherit from other base class.
  • Lightwight: This library contains only 5 files.
  • Docs and unit testing: 100% docs coverage, 99.6% code coverage.

Usage

Simple model json convert

// JSON:
{
    "uid":123456,
    "name":"Harry",
    "created":"1965-07-31T00:00:00+0000"
}

// Model:
@interface User : NSObject
@property UInt64 uid;
@property NSString *name;
@property NSDate *created;
@end
@implementation User
@end

	
// Convert json to model:
User *user = [User yy_modelWithJSON:json];
	
// Convert model to json:
NSDictionary *json = [user yy_modelToJSONObject];

If the type of an object in JSON/Dictionary cannot be matched to the property of the model, the following automatic conversion is performed. If the automatic conversion failed, the value will be ignored.

JSON/Dictionary Model
NSString NSNumber,NSURL,SEL,Class
NSNumber NSString
NSString/NSNumber C number (BOOL,int,float,NSUInteger,UInt64,...)
NaN and Inf will be ignored
NSString NSDate parsed with these formats:
yyyy-MM-dd
yyyy-MM-dd HH:mm:ss
yyyy-MM-dd'T'HH:mm:ss
yyyy-MM-dd'T'HH:mm:ssZ
EEE MMM dd HH:mm:ss Z yyyy
NSDate NSString formatted with ISO8601:
"YYYY-MM-dd'T'HH:mm:ssZ"
NSValue struct (CGRect,CGSize,...)
NSNull nil,0
"no","false",... @(NO),0
"yes","true",... @(YES),1

Match model property to different JSON key

// JSON:
{
    "n":"Harry Pottery",
    "p": 256,
    "ext" : {
        "desc" : "A book written by J.K.Rowing."
    },
    "ID" : 100010
}

// Model:
@interface Book : NSObject
@property NSString *name;
@property NSInteger page;
@property NSString *desc;
@property NSString *bookID;
@end
@implementation Book
+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"name" : @"n",
             @"page" : @"p",
             @"desc" : @"ext.desc",
             @"bookID" : @[@"id",@"ID",@"book_id"]};
}
@end

You can map a json key (key path) or an array of json key (key path) to one or multiple property name. If there's no mapper for a property, it will use the property's name as default.

Nested model

// JSON
{
    "author":{
        "name":"J.K.Rowling",
        "birthday":"1965-07-31T00:00:00+0000"
    },
    "name":"Harry Potter",
    "pages":256
}

// Model: (no need to do anything)
@interface Author : NSObject
@property NSString *name;
@property NSDate *birthday;
@end
@implementation Author
@end
	
@interface Book : NSObject
@property NSString *name;
@property NSUInteger pages;
@property Author *author;
@end
@implementation Book
@end

Container property

@class Shadow, Border, Attachment;

@interface Attributes
@property NSString *name;
@property NSArray *shadows; //Array<Shadow>
@property NSSet *borders; //Set<Border>
@property NSMutableDictionary *attachments; //Dict<NSString,Attachment>
@end

@implementation Attributes
+ (NSDictionary *)modelContainerPropertyGenericClass {
	// value should be Class or Class name.
    return @{@"shadows" : [Shadow class],
             @"borders" : Border.class,
             @"attachments" : @"Attachment" };
}
@end

Whitelist and blacklist

@interface User
@property NSString *name;
@property NSUInteger age;
@end
	
@implementation Attributes
+ (NSArray *)modelPropertyBlacklist {
    return @[@"test1", @"test2"];
}
+ (NSArray *)modelPropertyWhitelist {
    return @[@"name"];
}
@end

Data validate and custom transform

// JSON:
{
	"name":"Harry",
	"timestamp" : 1445534567
}
	
// Model:
@interface User
@property NSString *name;
@property NSDate *createdAt;
@end

@implementation User
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    NSNumber *timestamp = dic[@"timestamp"];
    if (![timestamp isKindOfClass:[NSNumber class]]) return NO;
    _createdAt = [NSDate dateWithTimeIntervalSince1970:timestamp.floatValue];
    return YES;
}
- (BOOL)modelCustomTransformToDictionary:(NSMutableDictionary *)dic {
    if (!_createdAt) return NO;
    dic[@"timestamp"] = @(n.timeIntervalSince1970);
    return YES;
}
@end

Coding/Copying/hash/equal/description

@interface YYShadow :NSObject <NSCoding, NSCopying>
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) CGSize size;
@end

@implementation YYShadow
- (void)encodeWithCoder:(NSCoder *)aCoder { [self yy_modelEncodeWithCoder:aCoder]; }
- (id)initWithCoder:(NSCoder *)aDecoder { self = [super init]; return [self yy_modelInitWithCoder:aDecoder]; }
- (id)copyWithZone:(NSZone *)zone { return [self yy_modelCopy]; }
- (NSUInteger)hash { return [self yy_modelHash]; }
- (BOOL)isEqual:(id)object { return [self yy_modelIsEqual:object]; }
- (NSString *)description { return [self yy_modelDescription]; }
@end

Installation

CocoaPods

  1. Add pod 'YYModel' to your Podfile.
  2. Run pod install or pod update.
  3. Import <YYModel/YYModel.h>.

Carthage

  1. Add github "ibireme/YYModel" to your Cartfile.
  2. Run carthage update --platform ios and add the framework to your project.
  3. Import <YYModel/YYModel.h>.

Manually

  1. Download all the files in the YYModel subdirectory.
  2. Add the source files to your Xcode project.
  3. Import YYModel.h.

Documentation

Full API documentation is available on CocoaDocs.
You can also install documentation locally using appledoc.

Requirements

This library requires iOS 6.0+ and Xcode 8.0+.

License

YYModel is provided under the MIT license. See LICENSE file for details.



中文介绍

高性能 iOS/OSX 模型转换框架。
(该项目是 YYKit 组件之一)

性能

处理 GithubUser 数据 10000 次耗时统计 (iPhone 6):

Benchmark result

更多测试代码和用例见 Benchmark/ModelBenchmark.xcodeproj

特性

  • 高性能: 模型转换性能接近手写解析代码。
  • 自动类型转换: 对象类型可以自动转换,详情见下方表格。
  • 类型安全: 转换过程中,所有的数据类型都会被检测一遍,以保证类型安全,避免崩溃问题。
  • 无侵入性: 模型无需继承自其他基类。
  • 轻量: 该框架只有 5 个文件 (包括.h文件)。
  • 文档和单元测试: 文档覆盖率100%, 代码覆盖率99.6%。

使用方法

简单的 Model 与 JSON 相互转换

// JSON:
{
    "uid":123456,
    "name":"Harry",
    "created":"1965-07-31T00:00:00+0000"
}

// Model:
@interface User : NSObject
@property UInt64 uid;
@property NSString *name;
@property NSDate *created;
@end
@implementation User
@end

	
// 将 JSON (NSData,NSString,NSDictionary) 转换为 Model:
User *user = [User yy_modelWithJSON:json];
	
// 将 Model 转换为 JSON 对象:
NSDictionary *json = [user yy_modelToJSONObject];

当 JSON/Dictionary 中的对象类型与 Model 属性不一致时,YYModel 将会进行如下自动转换。自动转换不支持的值将会被忽略,以避免各种潜在的崩溃问题。

JSON/Dictionary Model
NSString NSNumber,NSURL,SEL,Class
NSNumber NSString
NSString/NSNumber 基础类型 (BOOL,int,float,NSUInteger,UInt64,...)
NaN 和 Inf 会被忽略
NSString NSDate 以下列格式解析:
yyyy-MM-dd
yyyy-MM-dd HH:mm:ss
yyyy-MM-dd'T'HH:mm:ss
yyyy-MM-dd'T'HH:mm:ssZ
EEE MMM dd HH:mm:ss Z yyyy
NSDate NSString 格式化为 ISO8601:
"YYYY-MM-dd'T'HH:mm:ssZ"
NSValue struct (CGRect,CGSize,...)
NSNull nil,0
"no","false",... @(NO),0
"yes","true",... @(YES),1

Model 属性名和 JSON 中的 Key 不相同

// JSON:
{
    "n":"Harry Pottery",
    "p": 256,
    "ext" : {
        "desc" : "A book written by J.K.Rowing."
    },
    "ID" : 100010
}

// Model:
@interface Book : NSObject
@property NSString *name;
@property NSInteger page;
@property NSString *desc;
@property NSString *bookID;
@end
@implementation Book
//返回一个 Dict,将 Model 属性名对映射到 JSON 的 Key。
+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"name" : @"n",
             @"page" : @"p",
             @"desc" : @"ext.desc",
             @"bookID" : @[@"id",@"ID",@"book_id"]};
}
@end

你可以把一个或一组 json key (key path) 映射到一个或多个属性。如果一个属性没有映射关系,那默认会使用相同属性名作为映射。

在 json->model 的过程中:如果一个属性对应了多个 json key,那么转换过程会按顺序查找,并使用第一个不为空的值。

在 model->json 的过程中:如果一个属性对应了多个 json key (key path),那么转换过程仅会处理第一个 json key (key path);如果多个属性对应了同一个 json key,则转换过过程会使用其中任意一个不为空的值。

Model 包含其他 Model

// JSON
{
    "author":{
        "name":"J.K.Rowling",
        "birthday":"1965-07-31T00:00:00+0000"
    },
    "name":"Harry Potter",
    "pages":256
}

// Model: 什么都不用做,转换会自动完成
@interface Author : NSObject
@property NSString *name;
@property NSDate *birthday;
@end
@implementation Author
@end
	
@interface Book : NSObject
@property NSString *name;
@property NSUInteger pages;
@property Author *author; //Book 包含 Author 属性
@end
@implementation Book
@end

容器类属性

@class Shadow, Border, Attachment;

@interface Attributes
@property NSString *name;
@property NSArray *shadows; //Array<Shadow>
@property NSSet *borders; //Set<Border>
@property NSMutableDictionary *attachments; //Dict<NSString,Attachment>
@end

@implementation Attributes
// 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{@"shadows" : [Shadow class],
             @"borders" : Border.class,
             @"attachments" : @"Attachment" };
}
@end

黑名单与白名单

@interface User
@property NSString *name;
@property NSUInteger age;
@end
	
@implementation Attributes
// 如果实现了该方法,则处理过程中会忽略该列表内的所有属性
+ (NSArray *)modelPropertyBlacklist {
    return @[@"test1", @"test2"];
}
// 如果实现了该方法,则处理过程中不会处理该列表外的属性。
+ (NSArray *)modelPropertyWhitelist {
    return @[@"name"];
}
@end

数据校验与自定义转换

// JSON:
{
	"name":"Harry",
	"timestamp" : 1445534567
}
	
// Model:
@interface User
@property NSString *name;
@property NSDate *createdAt;
@end

@implementation User
// 当 JSON 转为 Model 完成后,该方法会被调用。
// 你可以在这里对数据进行校验,如果校验不通过,可以返回 NO,则该 Model 会被忽略。
// 你也可以在这里做一些自动转换不能完成的工作。
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    NSNumber *timestamp = dic[@"timestamp"];
    if (![timestamp isKindOfClass:[NSNumber class]]) return NO;
    _createdAt = [NSDate dateWithTimeIntervalSince1970:timestamp.floatValue];
    return YES;
}
	
// 当 Model 转为 JSON 完成后,该方法会被调用。
// 你可以在这里对数据进行校验,如果校验不通过,可以返回 NO,则该 Model 会被忽略。
// 你也可以在这里做一些自动转换不能完成的工作。
- (BOOL)modelCustomTransformToDictionary:(NSMutableDictionary *)dic {
    if (!_createdAt) return NO;
    dic[@"timestamp"] = @(n.timeIntervalSince1970);
    return YES;
}
@end

Coding/Copying/hash/equal/description

@interface YYShadow :NSObject <NSCoding, NSCopying>
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) CGSize size;
@end

@implementation YYShadow
// 直接添加以下代码即可自动完成
- (void)encodeWithCoder:(NSCoder *)aCoder { [self yy_modelEncodeWithCoder:aCoder]; }
- (id)initWithCoder:(NSCoder *)aDecoder { self = [super init]; return [self yy_modelInitWithCoder:aDecoder]; }
- (id)copyWithZone:(NSZone *)zone { return [self yy_modelCopy]; }
- (NSUInteger)hash { return [self yy_modelHash]; }
- (BOOL)isEqual:(id)object { return [self yy_modelIsEqual:object]; }
- (NSString *)description { return [self yy_modelDescription]; }
@end

安装

CocoaPods

  1. 在 Podfile 中添加 pod 'YYModel'
  2. 执行 pod installpod update
  3. 导入 <YYModel/YYModel.h>。

Carthage

  1. 在 Cartfile 中添加 github "ibireme/YYModel"
  2. 执行 carthage update --platform ios 并将生成的 framework 添加到你的工程。
  3. 导入 <YYModel/YYModel.h>。

手动安装

  1. 下载 YYModel 文件夹内的所有内容。
  2. 将 YYModel 内的源文件添加(拖放)到你的工程。
  3. 导入 YYModel.h

文档

你可以在 CocoaDocs 查看在线 API 文档,也可以用 appledoc 本地生成文档。

系统要求

该项目最低支持 iOS 6.0Xcode 8.0

许可证

YYModel 使用 MIT 许可证,详情见 LICENSE 文件。

相关链接

iOS JSON 模型转换库评测

Issues
  • 多级映射修改关键字

    多级映射修改关键字

    字典包数组包字典 中最下级的字典中key修改不成功.

    • (NSDictionary *)modelCustomPropertyMapper { return @{@"itemName" : @"data.name"}; } 原key为name 上级是data(这个是数组) 单使用@"name"也不好用 , 当给方法的时候 原key值name会crash 应该是被改了
    discussion 
    opened by synemin 18
  • 关于YYTextLayout model

    关于YYTextLayout model

    从服务端拿到json后,将son layout后得到一个layoutModel,然后将layoutModel转为dic存入数据库,然后从数据库拿到dic在转为layoutModel的时候,会不成功,textLayout很多属性没有。

    opened by wy19901227 15
  • 继承的类怎么解析,急,在线等

    继承的类怎么解析,急,在线等

    @interface BaseUser : NSObject @property (atomic, strong) NSString *userID; @property (atomic, strong) NSString *imID; @property (atomic, strong) NSString *name; @end @interface User : BaseUser @property (atomic, strong) NSString *mobile; @property (atomic, strong) NSString *hobbyDesc; @property (atomic, strong) NSString *desc; @end 像这样继承的类怎么解析? modelCustomPropertyMapper会被覆盖掉,[super modelCustomPropertyMapper]会报错,如果只写在User中,直接使用BaseUser的时候就没办法解析

    opened by YasinZhou 12
  • 有交流群吗,最近在研究你的代码

    有交流群吗,最近在研究你的代码

    我看到你的metaWithClass方法里面,meta的生成并没有添加在线程安全里面,不知道这样做是为什么

    opened by YasinZhou 11
  • 能否解析成 NSArray<NSString*,KeyModel*> 这种类型。

    能否解析成 NSArray 这种类型。

    "enum": { "Key1": [ { "Code": "0000", "Desc": "么么哒" } ], }

    KeyModel: @property() NSString *Code ; @property() NSString *Desc;

    像这样使用:

    • (NSDictionary _)modelContainerPropertyGenericClass { return @{@"enum" :[NSDictionary<NSString_,KeyModel*> class]}; }

    能否解析出: NSArray<NSString*,KeyModel*> *enumModel

    opened by XuYanci 10
  • 关于成功解析模型后的访问问题

    关于成功解析模型后的访问问题

    首先对大神进行膜拜并表示敬意... 第一种情况如果一个模型包含另一个模型,另一个模型里包含数组 解析后如何访问?

    {
    "items": [
              {
              "title": "首页",
              "key": "tab_home",
              "subitems": [
                           {
                           "type": "tab",
                           "title": "首页",
                           "image": "[email protected]",
                           "image_hl": "[email protected]"
                           }
                           ]
              },
              {
              "title": "直播",
              "key": "tab_live",
              "subitems": [
                           {
                           "type": "tab",
                           "title": "直播",
                           "image": "[email protected]",
                           "image_hl": "[email protected]"
                           }
                           ]
              },
    

    第二种情况模型中包含模型,为什么不能用model.model.属性的方法访问...

    {
    "items": [
              {
              "title": "首页",
              "key": "tab_home",
              "subitems": {
                           "type": "tab",
                           "title": "首页",
                           "image": "[email protected]",
                           "image_hl": "[email protected]"
                           }
    
              },
              {
              "title": "直播",
              "key": "tab_live",
              "subitems":
                           {
                           "type": "tab",
                           "title": "直播",
                           "image": "[email protected]",
                           "image_hl": "[email protected]"
                           }
    
              },
    

    xcode报错说我第二个模型是一个字典...

    help wanted 
    opened by iOS-Denzel 10
  • 现在的YYmodel和当年的MJExtension 都是用iVar的。

    现在的YYmodel和当年的MJExtension 都是用iVar的。

    当时MJ也做过性能测试,远远比其他用property的性能高, 后来MJExtension要支持core data,也用了property,但是 ,YYModel的写法要底层一点,和MJExtension比得话,用他的0.0.3版

    discussion 
    opened by wy19901227 8
  • modelCustomPropertyMapper 没调用

    modelCustomPropertyMapper 没调用

    modelCustomPropertyMapper 没调用 ,通过 NSArray yy_modelArrayWithClass:调用

    opened by applejian 8
  • 为什么+ (NSDictionary *)modelCustomPropertyMapper;不提示?

    为什么+ (NSDictionary *)modelCustomPropertyMapper;不提示?

    这个没法自动提示么?请求大神帮忙,太喜欢你的框架了

    opened by iOS-Denzel 7
  • N年了,不能过滤数组属性中的非法元素的BUG竟然还没有解决?

    N年了,不能过滤数组属性中的非法元素的BUG竟然还没有解决?

    直接看代码,在函数 ModelSetValueForProperty 中:

    https://github.com/ibireme/YYModel/blob/1230e605c1abdcd34bf0adb371d89783ff39a856/YYModel/NSObject%2BYYModel.m#L911-L913

    很明显,newOne 自创建后,就没有被修改过,所以 913 行的 if 语句判断了个寂寞,912 行里的数据校验即使返回 NO ,对象 newOne 依然会被添加到数组中。

    这个 BUG 应该是存在了 N 年之久~

    opened by Xezun 4
  • Fggghh

    Fggghh

    opened by pnowosie 0
  • 运行时如何获取类属性泛型的申明

    运行时如何获取类属性泛型的申明

    类的属性@property (nonatomic, copy) NSArray<List *> *list;
    怎么获取类属性前面的泛型的声明,例如这个尖括号里的“List”

    property_getAttributes 内容是 [email protected]"NSArray",&,N,V_list,只知道是NSArray,怎么获取尖括号里的“List”,谢谢

    opened by blooming2017 1
  • 何必呢

    何必呢

    opened by hufuping56 0
  • 使用YYModel应该明确或思考的几个问题

    使用YYModel应该明确或思考的几个问题

    YYModel实现了json的健值对与对象属性之间的双向映射,最基本的操作就是健值对转化为模型属性和其反向操作,使用instruments我们也可清晰的观察到双向转化占用了很大的时间比例。 下面只讨论json到对象的单向映射,在问题域上有下面7个基本问题需要考虑: 1)健值对与属性的映射是单射还是多射? 2)在嵌套的健值模型中,如何实现多层json结构扁平化? 3)在嵌套的健值模型中,如何把内层的复杂结构映射到当前模型的模型属性上? 4)如何实现多态映射? 5)如何根据json外层数据实现下层json的多态映射? 6)如何在模型转化的过程中清洗数据? 7)在OOP范式下YYModel还有什么设计缺陷吗?

    opened by duduWang20 1
  • feat: thread safe

    feat: thread safe

    #311

    opened by duduWang20 1
  • Does method + (instancetype)classInfoWithClass:(Class)cls;  in YYClassInfo thread-safe ?

    Does method + (instancetype)classInfoWithClass:(Class)cls; in YYClassInfo thread-safe ?

    • (instancetype)classInfoWithClass:(Class)cls { if (!cls) return nil; static CFMutableDictionaryRef classCache; static CFMutableDictionaryRef metaCache; static dispatch_once_t onceToken; static dispatch_semaphore_t lock; dispatch_once(&onceToken, ^{ classCache = CFDictionaryCreateMutable(CFAllocatorGetDefault(), 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); metaCache = CFDictionaryCreateMutable(CFAllocatorGetDefault(), 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); lock = dispatch_semaphore_create(1); }); dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); YYClassInfo *info = CFDictionaryGetValue(class_isMetaClass(cls) ? metaCache : classCache, (__bridge const void *)(cls)); if (info && info->_needUpdate) { [info _update]; } dispatch_semaphore_signal(lock); if (!info) { info = [[YYClassInfo alloc] initWithClass:cls]; if (info) { dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); CFDictionarySetValue(info.isMeta ? metaCache : classCache, (__bridge const void *)(cls), (__bridge const void *)(info)); dispatch_semaphore_signal(lock); } } return info; }
    opened by duduWang20 1
  • YYClassPropertyInfo中按位或运算符

    YYClassPropertyInfo中按位或运算符

    我想知道 YYClassPropertyInfo 在初始化的时候,对 type encoding 为什么使用 按位或的操作,为什么不直接对 type 赋值,这样做有什么好处吗?

              YYEncodingType type = 0;
                case 'R': {
                    type |= YYEncodingTypePropertyReadonly;
                } break;
                case 'C': {
                    type |= YYEncodingTypePropertyCopy;
                } break;
                case '&': {
                    type |= YYEncodingTypePropertyRetain;
                } break;
                case 'N': {
                    type |= YYEncodingTypePropertyNonatomic;
                } break;
                case 'D': {
                    type |= YYEncodingTypePropertyDynamic;
                } break;
                case 'W': {
                    type |= YYEncodingTypePropertyWeak;
                } break;
                case 'G': {
                    type |= YYEncodingTypePropertyCustomGetter;
                    if (attrs[i].value) {
                        _getter = NSSelectorFromString([NSString stringWithUTF8String:attrs[i].value]);
                    }
                } break;
    

    以及在 _YYModelPropertyMeta 的构造方法中:

        if ((meta->_type & YYEncodingTypeMask) == YYEncodingTypeObject) {
            meta->_nsType = YYClassGetNSType(propertyInfo.cls);
        }
    

    希望大神们能解释一下,感谢!!!

    opened by BlankConan 1
  • fix string type failure

    fix string type failure

    convert string type failure like that "{\"type\":3,\"cfg\":[{\"pos\":2,\"ct\":1},{\"pos\":3,\"ct\":3},{\"pos\":4,\"ct\":6},{\"pos\":5,\"ct\":10}]}"

    opened by biostome 0
Releases(1.0.4)
Model framework for Cocoa and Cocoa Touch

Mantle Mantle makes it easy to write a simple model layer for your Cocoa or Cocoa Touch application. The Typical Model Object What's wrong with the wa

null 11.3k Nov 20, 2021
Websockets in swift for iOS and OSX

Starscream is a conforming WebSocket (RFC 6455) library in Swift. Features Conforms to all of the base Autobahn test suite. Nonblocking. Everything ha

Dalton 7.1k Nov 12, 2021
JSONExport is a desktop application for Mac OS X which enables you to export JSON objects as model classes with their associated constructors, utility methods, setters and getters in your favorite language.

JSONExport JSONExport is a desktop application for Mac OS X written in Swift. Using JSONExport you will be able to: Convert any valid JSON object to a

Ahmed Ali 4.6k Nov 18, 2021
Objective-C library to easily map NSDictionary to model objects, works perfectly with Alamofire. ObjectMapper works similar to GSON

Data Mapping library for Objective C OCMapper is a data mapping library for Objective C that converts NSDictionary to NSObject. My inspiration behind

Aryan Ghassemi 346 Sep 19, 2021
flexible JSON to Model converter, specially optimized for immutable properties

Mappable Mappable is a lightweight, flexible, easy-to-use framework to convert JSON to model, specially optimized for immutable property initializatio

Leave 25 Jul 16, 2021
Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die

JSONNeverDie is an auto reflection tool from JSON to Model, a user friendly JSON encoder / decoder, aims to never die. Also JSONNeverDie is a very imp

John Lui 466 Nov 8, 2021
Magical Data Modeling Framework for JSON - allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS and tvOS apps.

JSONModel - Magical Data Modeling Framework for JSON JSONModel allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS

JSONModel 6.8k Nov 18, 2021
Magical Data Modeling Framework for JSON - allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS and tvOS apps.

JSONModel - Magical Data Modeling Framework for JSON JSONModel allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS

JSONModel 6.8k Aug 23, 2021
A reusable framework for parsing JSON in Swift.

Why Freddy? Parsing JSON elegantly and safely can be hard, but Freddy is here to help. Freddy is a reusable framework for parsing JSON in Swift. It ha

Big Nerd Ranch 1.1k Oct 3, 2021
A humane JSON Objective-C un-framework. (TouchJSON has been deprecated - see README)

TouchJSON HOWTO Introduction TouchJSON is an Objective-C based parser and generator for JSON encoded data. TouchJSON compiles for Mac OS X and iOS dev

null 809 Oct 28, 2021
Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable.

Elevate Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable. Elevate should no longer be used for

Nike Inc. 618 Nov 6, 2021
This framework implements a strict JSON parser and generator in Objective-C.

SBJson 5 Chunk-based JSON parsing and generation in Objective-C. Overview SBJson's number one feature is stream/chunk-based operation. Feed the parser

null 3.8k Nov 21, 2021
Swift/Obj-C HTTP framework with a focus on REST and JSON

PMHTTP PMHTTP is an HTTP framework built around URLSession and designed for Swift while retaining Obj-C compatibility. We think URLSession is great. B

Postmates Inc. 508 Oct 27, 2021
Property mapping for Objective-C iOS apps.

Stop repeating your data parsing code in iOS apps. Data parsing is one of most common tasks we need to do in our apps, yet still majority of people do

Krzysztof Zabłocki 1.1k Nov 18, 2021
A fast, convenient and nonintrusive conversion framework between JSON and model. Your model class doesn't need to extend any base class. You don't need to modify any model file.

MJExtension A fast, convenient and nonintrusive conversion framework between JSON and model. 转换速度快、使用简单方便的字典转模型框架 ?? ✍??Release Notes: more details ‼️

M了个J 8.5k Nov 19, 2021
High performance cache framework for iOS.

YYCache High performance cache framework for iOS. (It's a component of YYKit) Performance You may download and compile the latest version of sqlite an

null 2.3k Nov 17, 2021
Painless high-performance audio on iOS and Mac OS X

An analgesic for high-performance audio on iOS and OSX. Really fast audio in iOS and Mac OS X using Audio Units is hard, and will leave you scarred an

Alex Wiltschko 2.2k Nov 8, 2021
An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and  Watch.

KFSwiftImageLoader KFSwiftImageLoader is an extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memor

Kiavash Faisali 343 Sep 20, 2021
High-performance animated GIF support for iOS in Swift

Gifu adds protocol-based, performance-aware animated GIF support to UIKit. (It's also a prefecture in Japan). Install Swift Package Manager Add the fo

Reda Lemeden 2.7k Nov 24, 2021
High performance and delightful way to play with APNG format in iOS.

APNGKit is a high performance framework for loading and displaying APNG images in iOS and macOS. It's built on top of a modified version of libpng wit

Wei Wang 1.9k Nov 17, 2021
A high-performance button control with rounded corners for iOS.

TORoundedButton TORoundedButton is an open source UI control of a standard user button. Its design consists of displaying text on top of a solid recta

Tim Oliver 478 Nov 16, 2021
High performance and delightful way to play with APNG format in iOS.

APNGKit is a high performance framework for loading and displaying APNG images in iOS and macOS. It's built on top of a modified version of libpng wit

Wei Wang 1.9k Nov 13, 2021
High-performance animated GIF support for iOS in Swift

Gifu adds protocol-based, performance-aware animated GIF support to UIKit. (It's also a prefecture in Japan). Install Swift Package Manager Add the fo

Reda Lemeden 2.7k Nov 25, 2021
High performance Swift treemap layout engine for iOS and macOS.

Synopsis YMTreeMap is a high performance treemap layout engine for iOS and macOS, written in Swift. The input to YMTreeMap is a list of arbitrary numb

Yahoo 80 Nov 15, 2021
🥷 High-performance polyline simplification library - port of simplify.js

High-performance polyline simplification library SwiftSimplify is a tiny high-performance Swift polyline simplification library ported from Javascript

Daniele Margutti 261 Aug 23, 2021
A high-performance image library for downloading, caching, and processing images in Swift.

Features Asynchronous image downloader with priority queuing Advanced memory and database caching using YapDatabase (SQLite) Guarantee of only one ima

Yap Studios 71 Nov 14, 2021
High performance GIF engine

SwiftyGif High performance & easy to use Gif engine Features UIImage and UIImageView extension based Remote GIFs with customizable loader Great CPU/Me

Alexis Creuzot 1.5k Nov 19, 2021
High Performance (nearly)100% Swift Web server supporting dynamic content.

Dynamo - Dynamic Swift Web Server Starting this project the intention was to code the simplest possible Web Server entirely in Swift. Unfortunately I

John Holdsworth 69 Nov 14, 2021
High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton, Promise and more.

SwiftyUI High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton and more. Features SwiftyView GPU rendering Image and Color

Haoking 336 Nov 6, 2021