🍎 IFLYCodeUtils - Objective-C 工具库组织
📋 GitHub组织简介(OC专精版)
IFLYCodeUtils 是一个专注于 Objective-C 开发的工具库组织,致力于为 iOS/macOS 开发者提供高质量、可复用的 OC 工具类和组件,让 Objective-C 开发更加高效、现代化。
📖 详细组织简介
IFLYCodeUtils 是一个专注于 Objective-C 语言的开源工具组织。我们为 iOS/macOS 开发者提供企业级的 Objective-C 工具库,帮助你在 Swift 时代依然能够高效、优雅地开发和维护 Objective-C 项目。
@iflycodeutils/core-oc # 核心基础工具
@iflycodeutils/category-kit # 常用Category集合
@iflycodeutils/network-oc # 网络请求封装
@iflycodeutils/storage-oc # 数据存储方案
@iflycodeutils/ui-components # UI组件库
@iflycodeutils/runtime-tools # Runtime工具集
@iflycodeutils/debug-tools # 调试开发工具
@iflycodeutils/security-kit # 安全加密工具
@iflycodeutils/performance # 性能优化工具
@iflycodeutils/legacy-migrate # 旧项目迁移工具
@iflycodeutils/swift-bridge # Swift混编工具
@iflycodeutils/arch-patterns # 架构模式实现
ruby
Podfile
pod 'IFLYCore', '~> 1.0.0'
或
pod 'IFLYCategoryKit', '~> 1.0.0'
objective-c
// 字符串工具
import <IFLYCore/IFLYStringUtils.h>
NSString *trimmed = [IFLYStringUtils trimAllWhitespace:@" hello "];
BOOL isValid = [IFLYStringUtils isValidEmail:@"test@example.com"];
// 日期工具
import <IFLYCore/IFLYDateUtils.h>
NSString *timestamp = [IFLYDateUtils currentTimestamp];
NSString *prettyDate = [IFLYDateUtils prettyDateFrom:[NSDate date]];
// 网络请求
import <IFLYNetwork/IFLYHTTPManager.h>
[[IFLYHTTPManager shared] GET:@"https://api.example.com/data"
parameters:@{@"page": @1}
success:^(NSDictionary *response) {
// 处理成功
} failure:^(NSError *error) {
// 处理失败
}];
objective-c
// 方法交换(安全版)
[IFLYRuntimeUtils swizzleInstanceMethod:[UIViewController class]
originalSel:@selector(viewDidLoad)
swizzledSel:@selector(ifly_viewDidLoad)];
// 属性操作
NSArray *properties = [IFLYRuntimeUtils getAllProperties:[MyClass class]];
// KVO 安全封装
[self ifly_addObserver:self forKeyPath:@"name" options:NSKeyValueObservingOptionNew];
objective-c
// UIKit 增强
UIImage *rounded = [image ifly_roundedCornerImageWithRadius:10];
UIColor *color = [UIColor ifly_colorWithHexString:@"#FF6B6B"];
// Foundation 增强
NSArray *safeArray = [array ifly_safeObjectAtIndex:5];
NSDictionary *merged = [dict1 ifly_merge:dict2];
// 链式语法支持
UILabel *label = [UILabel new]
.ifly_text(@"Hello")
.ifly_font([UIFont systemFontOfSize:16])
.ifly_textColor([UIColor blackColor]);
objective-c
// 基于 NSURLSession 的现代封装
IFLYNetworkManager *manager = [IFLYNetworkManager manager];
// 支持 Promise 风格
[manager requestWithURL:@"https://api.example.com/user"
method:IFLYHTTPMethodGET
parameters:nil]
.then(^id(IFLYResponse *response) {
// 成功处理
return response.data;
})
.catch(^(NSError *error) {
// 错误处理
});
// 文件上传
[manager uploadFile:fileData
to:@"https://api.example.com/upload"
progress:^(CGFloat progress) {
NSLog(@"进度: %.2f%%", progress * 100);
}];
ruby
platform :ios, '9.0'
target 'MyApp' do
pod 'IFLYCore', '> 1.0'> 1.0'
pod 'IFLYCategoryKit', '
pod 'IFLYNetworkOC', '~> 2.0'
pod 'IFLYUIKit', '~> 1.0'
pod 'IFLYDebugTools', :configurations => ['Debug']
end
objective-c
import "AppDelegate.h"
import <IFLYCore/IFLYCore.h>
import <IFLYNetwork/IFLYNetworkConfig.h>
@implementation AppDelegate
• (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 1. 初始化工具库
[IFLYManager setupWithConfig:^(IFLYConfig *config) {
config.enableLog = YES;
config.logLevel = IFLYLogLevelDebug;
config.enableExceptionHandler = YES;
}];
// 2. 配置网络
[IFLYNetworkConfig sharedConfig].baseURL = @"https://api.example.com";
[IFLYNetworkConfig sharedConfig].timeoutInterval = 30.0;
// 3. 配置缓存
[IFLYCacheManager setupWithMaxMemoryCost:50 1024 1024]; // 50MB
return YES;
}
@end
┌─────────────────────────────────────┐
│ Your App │
├─────────────────────────────────────┤
│ IFLYUIKit │ IFLYNetwork │
├─────────────────────────────────────┤
│ IFLYCategoryKit │ IFLYStorage │
├─────────────────────────────────────┤
│ IFLYCore Foundation │
└─────────────────────────────────────┘
我们提供丰富的 Xcode Code Snippets:
objective-c
// 快速创建单例
<#className#> *instance = [[self alloc] init];
return instance;
objective-c
// 内存泄漏检测
[IFLYLeakDetector startMonitoring];
// 性能监控
[IFLYPerformanceMonitor startTracking:@"ViewController"];
// 日志系统
IFLYLogDebug(@"网络请求开始: %@", url);
IFLYLogInfo(@"用户登录成功: %@", userId);
IFLYLogError(@"网络错误: %@", error);
objective-c
// 1. 使用前缀防止冲突
// 正确:
@interface IFLYStringUtils : NSObject
// 错误:
@interface StringUtils : NSObject
// 2. 完整的nullability注解
@property (nonatomic, copy, readonly, nullable) NSString *title;
// 3. 使用NS_DESIGNATED_INITIALIZER
• (instancetype)initWithName:(NSString *)name NS_DESIGNATED_INITIALIZER;
bash
feat: 添加新的字符串加密工具
fix: 修复网络请求内存泄漏问题
docs: 更新README安装说明
test: 增加IFLYDateUtils单元测试
chore: 更新Podspec版本号
所有项目均采用 MIT 许可证 - 详见各项目 LICENSE 文件
在 Swift 成为主流的今天,我们依然坚持维护 Objective-C 工具库,因为:
如果你在维护 Objective-C 项目,欢迎:
IFLYCodeUtils - 让 Objective-C 开发重回巅峰时代!
🎯 第一个仓库推荐:IFLYCore-OC
Objective-C 核心工具库,包含字符串、日期、数组、字典等常用工具类。
ruby
pod 'IFLYCore-OC'
💡 组织标语建议