Convert Figma logo to code with AI

ibireme logoYYKit

A collection of iOS components.

13,992
3,691
13,992
303

Top Related Projects

A delightful networking framework for iOS, macOS, watchOS, and tvOS.

Asynchronous image downloader with cache support as a UIImageView category

Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

11,328

Model framework for Cocoa and Cocoa Touch

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.

Quick Overview

YYKit is a comprehensive collection of iOS components and utility classes designed to simplify and accelerate iOS development. It provides a wide range of features, including model-to-JSON conversion, image and web image loading, caching mechanisms, and various UI components.

Pros

  • Extensive feature set covering many common iOS development needs
  • High performance and optimized implementations
  • Well-documented and actively maintained
  • Modular design allowing developers to use only the components they need

Cons

  • Large codebase may increase app size if not carefully managed
  • Some components may overlap with native iOS APIs or other popular libraries
  • Learning curve can be steep due to the wide range of features
  • Dependency on a third-party library may complicate long-term maintenance

Code Examples

  1. JSON to Model conversion:
// Define a model
@interface User : NSObject
@property NSString *name;
@property NSInteger age;
@end

// Convert JSON to model
NSDictionary *json = @{@"name": @"John", @"age": @25};
User *user = [User yy_modelWithJSON:json];
  1. Asynchronous image loading:
UIImageView *imageView = [[UIImageView alloc] init];
[imageView yy_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
                   placeholder:[UIImage imageNamed:@"placeholder"]];
  1. Key-value observing:
[object yy_addObserverBlockForKeyPath:@"someProperty" block:^(id _Nonnull obj, id _Nullable oldVal, id _Nullable newVal) {
    NSLog(@"Property changed from %@ to %@", oldVal, newVal);
}];

Getting Started

  1. Add YYKit to your project using CocoaPods:
pod 'YYKit'
  1. Import YYKit in your source files:
#import <YYKit/YYKit.h>
  1. Start using YYKit components in your code:
// Example: Using YYCache
YYCache *cache = [YYCache cacheWithName:@"MyCache"];
[cache setObject:@"value" forKey:@"key"];
id object = [cache objectForKey:@"key"];

Competitor Comparisons

A delightful networking framework for iOS, macOS, watchOS, and tvOS.

Pros of AFNetworking

  • Focused specifically on networking tasks, providing a comprehensive set of tools for HTTP/HTTPS requests
  • Well-established and widely adopted in the iOS development community
  • Extensive documentation and community support

Cons of AFNetworking

  • Limited to networking functionality, unlike YYKit's broader scope
  • May require additional libraries for non-networking tasks
  • Less frequent updates compared to YYKit

Code Comparison

AFNetworking:

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager GET:@"https://api.example.com/data" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
    NSLog(@"JSON: %@", responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
    NSLog(@"Error: %@", error);
}];

YYKit:

YYURLRequest *request = [YYURLRequest requestWithURL:[NSURL URLWithString:@"https://api.example.com/data"]];
[request startWithCompletionBlockWithSuccess:^(YYURLRequest *request) {
    id responseObject = request.responseJSONObject;
    NSLog(@"JSON: %@", responseObject);
} failure:^(YYURLRequest *request) {
    NSLog(@"Error: %@", request.error);
}];

Both examples demonstrate a simple GET request, showcasing the similar approach but different syntax and method names used by each library.

Asynchronous image downloader with cache support as a UIImageView category

Pros of SDWebImage

  • More focused and specialized for image loading and caching
  • Extensive documentation and community support
  • Regular updates and maintenance

Cons of SDWebImage

  • Limited to image-related functionality
  • May require additional libraries for other tasks

Code Comparison

SDWebImage:

[imageView sd_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
             placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

YYKit:

[imageView yy_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
             placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

Additional Notes

YYKit is a comprehensive iOS development framework that includes image loading and caching along with many other features. SDWebImage, on the other hand, focuses solely on image loading, caching, and management.

YYKit provides a wider range of functionality, including text rendering, JSON model, cache, and animations. This makes it a more all-in-one solution for iOS development.

SDWebImage's specialized focus on image handling makes it a lighter-weight option for projects that only need image-related features. It also benefits from a larger community and more frequent updates specifically tailored to image management.

Both libraries offer similar syntax for basic image loading, making it easy to switch between them if needed.

Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

Pros of ReactiveCocoa

  • Provides a comprehensive reactive programming framework
  • Supports functional reactive programming (FRP) paradigm
  • Offers powerful stream processing and event handling capabilities

Cons of ReactiveCocoa

  • Steeper learning curve for developers new to reactive programming
  • Can lead to more complex code for simple tasks
  • Potential performance overhead for heavy signal processing

Code Comparison

ReactiveCocoa:

RACSignal *signal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
    [subscriber sendNext:@"Hello, Reactive World!"];
    [subscriber sendCompleted];
    return nil;
}];
[signal subscribeNext:^(id x) {
    NSLog(@"%@", x);
}];

YYKit:

YYCache *cache = [YYCache cacheWithName:@"myCache"];
[cache setObject:@"Hello, YYKit World!" forKey:@"greeting"];
NSString *greeting = [cache objectForKey:@"greeting"];
NSLog(@"%@", greeting);

While ReactiveCocoa focuses on reactive programming and signal processing, YYKit provides a more traditional approach with a collection of utilities for iOS development. ReactiveCocoa is better suited for complex, event-driven applications, while YYKit offers a broader range of utilities for general iOS development tasks.

11,328

Model framework for Cocoa and Cocoa Touch

Pros of Mantle

  • More focused on model object serialization and data transformation
  • Better documentation and community support
  • Lightweight and easy to integrate into existing projects

Cons of Mantle

  • Less comprehensive feature set compared to YYKit
  • May require additional libraries for certain functionalities
  • Slightly steeper learning curve for beginners

Code Comparison

Mantle:

@interface Person : MTLModel <MTLJSONSerializing>
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) NSNumber *age;
@end

@implementation Person
+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    return @{@"name": @"full_name", @"age": @"years_old"};
}
@end

YYKit:

@interface Person : NSObject
@property NSString *name;
@property NSNumber *age;
@end

@implementation Person
+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"name": @"full_name", @"age": @"years_old"};
}
@end

Both libraries provide similar functionality for JSON mapping, but Mantle requires conforming to a protocol and subclassing MTLModel, while YYKit uses a category on NSObject for more flexibility. YYKit's implementation is slightly more concise, but Mantle offers more built-in features for model object handling.

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.

Pros of MJExtension

  • Lightweight and focused specifically on JSON/model conversion
  • Simple API with easy-to-use methods for common tasks
  • Extensive documentation and examples in Chinese

Cons of MJExtension

  • Less comprehensive feature set compared to YYKit
  • Limited to JSON/model conversion, lacking other utility functions
  • May have slower performance for complex nested structures

Code Comparison

MJExtension:

@interface User : NSObject
@property (copy, nonatomic) NSString *name;
@property (strong, nonatomic) NSNumber *age;
@end

NSDictionary *dict = @{@"name": @"Jack", @"age": @20};
User *user = [User mj_objectWithKeyValues:dict];

YYKit:

@interface User : NSObject
@property NSString *name;
@property NSInteger age;
@end

NSDictionary *dict = @{@"name": @"Jack", @"age": @20};
User *user = [User yy_modelWithDictionary:dict];

MJExtension focuses solely on JSON/model conversion, making it a good choice for projects that only need this functionality. It offers a straightforward API and extensive Chinese documentation. However, YYKit provides a more comprehensive set of utilities and may offer better performance for complex data structures. YYKit's code is slightly more concise, but both libraries offer similar ease of use for basic JSON/model conversion tasks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

YYKit

License MIT  Carthage compatible  CocoaPods  CocoaPods  Support  Build Status

YYKit is a collection of iOS components.

It's so huge that I split it into several independent components:

  • YYModel — High performance model framework for iOS.
  • YYCache — High performance cache framework for iOS.
  • YYImage — Image framework for iOS to display/encode/decode animated WebP, APNG, GIF.
  • YYWebImage — Asynchronous image loading framework.
  • YYText — Powerful rich text component for iOS.
  • YYKeyboardManager — Access keyboard view and track keyboard animation.
  • YYDispatchQueuePool — iOS utility class to manage global dispatch queue.
  • YYAsyncLayer — iOS utility classes for asynchronous rendering and display.
  • YYCategories — A set of useful categories for Foundation and UIKit.

Demo Project

See Demo/YYKitDemo.xcodeproj


Installation

CocoaPods

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

Carthage

  1. Add github "ibireme/YYKit" to your Cartfile.
  2. Run carthage update --platform ios and add the framework to your project.
  3. Import <YYKit/YYKit.h>.
  4. Notice: carthage framework doesn't include webp component, if you want to support webp, use CocoaPods or install manually.

Manually

  1. Download all the files in the YYKit subdirectory.
  2. Add the source files to your Xcode project.
  3. Add -fno-objc-arc compiler flag to NSObject+YYAddForARC.m and NSThread+YYAdd.m.
  4. Link with required frameworks:
    • UIKit
    • CoreFoundation
    • CoreText
    • CoreGraphics
    • CoreImage
    • QuartzCore
    • ImageIO
    • AssetsLibrary
    • Accelerate
    • MobileCoreServices
    • SystemConfiguration
    • sqlite3
    • libz
  5. Add Vendor/WebP.framework(static library) to your Xcode project if you want to support WebP.
  6. Import YYKit.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+.

Notice

I want to use the APIs as if it was provided by system, and I don't add prefix in these categories. I do not recommend using the YYKit directly, you should try the separated components first.

License

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



中文介绍

YYKit 是一组功能丰富的 iOS 组件。

为了尽量复用代码,这个项目中的某些组件之间有比较强的依赖关系。为了方便其他开发者使用,我从中拆分出以下独立组件:

  • YYModel — 高性能的 iOS JSON 模型框架。
  • YYCache — 高性能的 iOS 缓存框架。
  • YYImage — 功能强大的 iOS 图像框架。
  • YYWebImage — 高性能的 iOS 异步图像加载框架。
  • YYText — 功能强大的 iOS 富文本框架。
  • YYKeyboardManager — iOS 键盘监听管理工具。
  • YYDispatchQueuePool — iOS 全局并发队列管理工具。
  • YYAsyncLayer — iOS 异步绘制与显示的工具。
  • YYCategories — 功能丰富的 Category 类型工具库。

演示项目

查看并运行 Demo/YYKitDemo.xcodeproj


安装

CocoaPods

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

Carthage

  1. 在 Cartfile 中添加 github "ibireme/YYKit"。
  2. 执行 carthage update --platform ios 并将生成的 framework 添加到你的工程。
  3. 导入 <YYKit/YYKit.h>。
  4. 注意: carthage framework 并没有包含 webp 组件。如果你需要支持 webp,可以用 CocoaPods 安装,或者手动安装。

手动安装

  1. 下载 YYKit 文件夹内的所有内容。
  2. 将 YYKit 内的源文件添加(拖放)到你的工程。
  3. 为 NSObject+YYAddForARC.m 和 NSThread+YYAdd.m 添加编译参数 -fno-objc-arc。
  4. 链接以下 frameworks:
    • UIKit
    • CoreFoundation
    • CoreText
    • CoreGraphics
    • CoreImage
    • QuartzCore
    • ImageIO
    • AssetsLibrary
    • Accelerate
    • MobileCoreServices
    • SystemConfiguration
    • sqlite3
    • libz
  5. 如果你需要支持 WebP,可以将 Vendor/WebP.framework(静态库) 加入你的工程。
  6. 导入 YYKit.h。

文档

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

系统要求

该项目最低支持 iOS 6.0 和 Xcode 8.0。

注意

我希望调用 API 时,有着和调用系统自带 API 一样的体验,所以我并没有为 Category 方法添加前缀。我已经用工具扫描过这个项目中的 API,确保没有对系统 API 产生影响,但即使这样没有前缀的 Category 也可能会带来其他麻烦。因此我不太推荐直接使用 YYKit 这个库,你应该先尝试一下上面那些拆分出来的独立组件。

许可证

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

相关文章

iOS 保持界面流畅的技巧