
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
64 lines
1.5 KiB
Objective-C
64 lines
1.5 KiB
Objective-C
//
|
|
// NSMutableArray+Safe.h
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2023/11/15.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface NSMutableArray (Safe)
|
|
|
|
/**
|
|
安全地从数组中移除指定索引的对象
|
|
如果索引超出范围,则不执行任何操作
|
|
|
|
@param index 要移除的对象的索引
|
|
*/
|
|
- (void)xpSafeRemoveObjectAtIndex:(NSUInteger)index;
|
|
|
|
/**
|
|
安全地从数组中移除指定的对象
|
|
如果对象不存在,则不执行任何操作
|
|
|
|
@param anObject 要移除的对象
|
|
*/
|
|
- (void)xpSafeRemoveObject:(id)anObject;
|
|
|
|
/**
|
|
安全地从数组中移除指定索引集合中的对象
|
|
如果索引集合中的任何索引超出范围,则跳过该索引
|
|
|
|
@param indexes 要移除的对象的索引集合
|
|
*/
|
|
- (void)xpSafeRemoveObjectsAtIndexes:(NSIndexSet *)indexes;
|
|
|
|
/**
|
|
安全地在指定索引处插入对象
|
|
如果索引超出范围,则不执行任何操作或在末尾添加(取决于索引)
|
|
|
|
@param anObject 要插入的对象
|
|
@param index 要插入的位置
|
|
*/
|
|
- (void)xpSafeInsertObject:(id)anObject atIndex:(NSUInteger)index;
|
|
|
|
/**
|
|
安全地替换指定索引处的对象
|
|
如果索引超出范围,则不执行任何操作
|
|
|
|
@param index 要替换的对象的索引
|
|
@param anObject 替换的对象
|
|
*/
|
|
- (void)xpSafeReplaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;
|
|
|
|
/**
|
|
安全地移除数组中的所有对象
|
|
如果数组为空,则不执行任何操作
|
|
*/
|
|
- (void)xpSafeRemoveAllObjects;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END |