CLFoundation
是對系統Foundation API
進行擴展的庫, API
的用法所有都在CLFoundationExample
裏, 若是在使用庫遇到的一些疑惑歡迎隨時Issues
給我.html
支持CocoaPod
管理git
pod 'CLFoundation'github
若是您以爲挺讚的話, 能夠給我打賞打賞, 謝謝啦~正則表達式
CLSpeechSynthesizer基於AVFoundation實現的語音播報工具類:objective-c
+ (instancetype)sharedSpeechSynthesizer;
- (BOOL)cl_isSpeaking;
- (void)cl_speakString:(NSString *)string;
- (void)cl_stopSpeak;
- (void)cl_chooseVoiceWithLanguage:(NSString *)language
speakSpeed:(CGFloat)speakSpeed;
複製代碼
針對Foundation
的NSArray
進行系統外的方法補充:api
+ (instancetype)cl_initSafeArrayWithObject:(id)object;
- (id)cl_safeObjectAtIndex:(NSUInteger)index;
- (NSArray *)cl_safeArrayWithRange:(NSRange)range;
- (NSUInteger)cl_safeIndexOfObject:(id)object;
+ (NSArray *)cl_getArrayWithPlistName:(NSString *)name;
複製代碼
針對Foundation
的NSAttributedString
進行系統外的方法補充:app
- (CGFloat)cl_attributedStringHeightWithContainWidth:(CGFloat)width;
+ (NSAttributedString *)cl_attributeStringWithString:(NSString *)string
color:(UIColor *)color
range:(NSRange)range;
+ (NSAttributedString *)cl_attributeStringWithAttributedString:(NSAttributedString *)attributedString
color:(UIColor *)color
range:(NSRange)range;
+ (NSAttributedString *)cl_attributeStringWithString:(NSString *)string
font:(UIFont *)font
range:(NSRange)range;
+ (NSAttributedString *)cl_attributeStringWithAttributedString:(NSAttributedString *)attributedString
font:(UIFont *)font
range:(NSRange)range;
+ (NSAttributedString *)cl_attributeStringWithPrefixString:(NSString *)prefixString
prefixFont:(UIFont *)prefixFont
suffixString:(NSString *)suffixString
suffixFont:(UIFont *)suffixFont;
+ (NSAttributedString *)cl_attributeStringWithPrefixString:(NSString *)prefixString
prefixFont:(UIFont *)prefixFont
prefixColor:(UIColor *)prefixColor
suffixString:(NSString *)suffixString
suffixFont:(UIFont *)suffixFont
suffixColor:(UIColor *)suffixColor;
複製代碼
針對Foundation
的NSBundle
進行系統外的方法補充:ide
+ (NSString *)cl_getBundleDisplayName;
+ (NSString *)cl_getBundleShortVersionString;
+ (NSString *)cl_getBundleVersion;
+ (NSString *)cl_getBundleIdentifier;
複製代碼
針對Foundation
的NSData
進行系統外的方法補充:svg
typedef NS_ENUM(NSInteger, CLEncodedType) {
CLEncodedType64 = 64,
CLEncodedType76 = 76
};
+ (NSData *)cl_compressOriginalImage:(UIImage *)image
compressionQuality:(CGFloat)compressionQuality;
+ (NSString *)cl_replacingAPNsTokenWithData:(NSData *)data;
+ (NSData *)cl_transformDataWithBase64EncodedString:(NSString *)string;
+ (NSString *)cl_transformBase64EncodedStringWithData:(NSData *)data
wrapWidth:(CLEncodedType)wrapWidth;
- (NSData *)cl_encryptedDataWithAESKey:(NSString *)key
encryptData:(NSData *)encryptData;
- (NSData *)cl_decryptedDataWithAESKey:(NSString *)key
decryptData:(NSData *)decryptData;
- (NSData *)cl_encryptedDataWith3DESKey:(NSString *)key
encryptData:(NSData *)encryptData;
- (NSData *)cl_decryptedDataWith3DEKey:(NSString *)key
decryptData:(NSData *)decryptData;
- (NSString *)cl_encryptredMD2String;
- (NSData *)cl_encryptredMD2Data;
- (NSString *)cl_encryptredMD4String;
- (NSData *)cl_encryptredMD4Data;
- (NSString *)cl_encryptredMD5String;
- (NSString *)cl_hmacEncryptredMD5StringWithKey:(NSString *)key;
- (NSData *)cl_encryptredMD5Data;
- (NSData *)cl_hmacEncryptredMD5DataWithKey:(NSData *)key;
- (NSString *)cl_encryptredSHA1String;
- (NSString *)cl_hmacEncryptredSHA1StringWithKey:(NSString *)key;
- (NSData *)cl_encryptredSHA1Data;
- (NSData *)cl_hmacEncryptredSHA1DataWithKey:(NSData *)key;
- (NSString *)cl_encryptredSHA224String;
- (NSString *)cl_hmacEncryptredSHA224StringWithKey:(NSString *)key;
- (NSData *)cl_encryptredSHA224Data;
- (NSData *)cl_hmacEncryptredSHA224DataWithKey:(NSData *)key;
- (NSString *)cl_encryptredSHA256String;
- (NSString *)cl_hmacEncryptredSHA256StringWithKey:(NSString *)key;
- (NSData *)cl_encryptredSHA256Data;
- (NSData *)cl_hmacEncryptredSHA256DataWithKey:(NSData *)key;
- (NSString *)cl_encryptredSHA384String;
- (NSString *)cl_hmacEncryptredSHA384StringWithKey:(NSString *)key;
- (NSData *)cl_encryptredSHA384Data;
- (NSData *)cl_hmacEncryptredSHA384DataWithKey:(NSData *)key;
- (NSString *)cl_encryptredSHA512String;
- (NSString *)cl_hmacEncryptredSHA512StringWithKey:(NSString *)key;
- (NSData *)cl_encryptredSHA512Data;
- (NSData *)cl_hmacEncryptredSHA512DataWithKey:(NSData *)key;
- (id)cl_dataJSONValueDecoded;
+ (NSData *)cl_getDataWithBundleNamed:(NSString *)name;
複製代碼
針對Foundation
的NSDate
進行系統外的方法補充:工具
@property (nonatomic, readonly) NSInteger cl_year;
@property (nonatomic, readonly) NSInteger cl_month;
@property (nonatomic, readonly) NSInteger cl_day;
@property (nonatomic, readonly) NSInteger cl_hour;
@property (nonatomic, readonly) NSInteger cl_minute;
@property (nonatomic, readonly) NSInteger cl_second;
@property (nonatomic, readonly) NSInteger cl_nanosecond;
@property (nonatomic, readonly) NSInteger cl_weekday;
@property (nonatomic, readonly) NSInteger cl_weekdayOrdinal;
@property (nonatomic, readonly) NSInteger cl_weekOfMonth;
@property (nonatomic, readonly) NSInteger cl_weekOfYear;
@property (nonatomic, readonly) NSInteger cl_yearForWeekOfYear;
@property (nonatomic, readonly) NSInteger cl_quarter;
@property (nonatomic, readonly) BOOL cl_isLeapMonth;
@property (nonatomic, readonly) BOOL cl_isLeapYear;
@property (nonatomic, readonly) BOOL cl_isToday;
@property (nonatomic, readonly) BOOL cl_isYesterday;
複製代碼
+ (NSString *)cl_compareCureentTimeWithDate:(NSTimeInterval)timeStamp;
+ (NSString *)cl_getCurrentTimeStampString;
+ (NSTimeInterval)cl_getCurrentTimeStamp;
+ (NSString *)cl_displayTimeWithTimeStamp:(NSTimeInterval)timeStamp;
+ (NSString *)cl_calculateDaysWithDate:(NSDate *)date;
複製代碼
+ (NSUInteger)cl_getEraWithDate:(NSDate *)date;
+ (NSUInteger)cl_getYearWithDate:(NSDate *)date;
+ (NSUInteger)cl_getMonthWithDate:(NSDate *)date;
+ (NSUInteger)cl_getDayWithDate:(NSDate *)date;
+ (NSUInteger)cl_getHourWithDate:(NSDate *)date;
+ (NSUInteger)cl_getMinuteWithDate:(NSDate *)date;
+ (NSUInteger)cl_getSecondWithDate:(NSDate *)date;
+ (NSInteger)cl_getWeekdayStringFromDate:(NSDate *)date;
+ (NSInteger)cl_getDateTimeDifferenceWithBeginDate:(NSDate *)beginDate
endDate:(NSDate *)endDate;
+ (NSDate *)cl_getMonthFirstDeteWithDate:(NSDate *)date;
+ (NSDate *)cl_getMonthLastDayWithDate:(NSDate *)date;
+ (NSUInteger)cl_getWeekOfYearWithDate:(NSDate *)date;
+ (NSDate *)cl_getTomorrowDay:(NSDate *)date;
+ (NSDate *)cl_getYearDateWithDate:(NSDate *)date
years:(NSInteger)years;
+ (NSDate *)cl_getMonthDateWithDate:(NSDate *)date
months:(NSInteger)months;
+ (NSDate *)cl_getDaysDateWithDate:(NSDate *)date
days:(NSInteger)days;
+ (NSDate *)cl_getHoursDateWithDate:(NSDate *)date
hours:(NSInteger)hours;
複製代碼
+ (NSString *)cl_getStringDateWithTimeStamp:(NSTimeInterval)timeStamp
formatter:(NSString *)formatter;
- (NSString *)cl_getStringDateWithFormatter:(NSString *)formatter;
+ (NSString *)cl_getStringDateWithDate:(NSDate *)date
formatter:(NSString *)formatter;
+ (NSString *)cl_getStringDateWithDate:(NSDate *)date
formatter:(NSString *)formatter
timeZone:(NSTimeZone *)timeZone
locale:(NSLocale *)locale;
+ (NSDate *)cl_getDateWithDateString:(NSString *)dateString
formatter:(NSString *)formatter;
+ (NSDate *)cl_getDateWithDateString:(NSString *)dateString
formatter:(NSString *)formatter
timeZone:(NSTimeZone *)timeZone
locale:(NSLocale *)locale;
複製代碼
+ (BOOL)cl_isLeapYear:(NSDate *)date;
+ (BOOL)cl_checkTodayWithDate:(NSDate *)date;
複製代碼
+ (NSDateComponents *)cl_getCalendarWithUnitFlags:(NSCalendarUnit)unitFlags
date:(NSDate *)date;
複製代碼
針對Foundation
的NSDictionary
進行系統外的方法補充:
+ (NSDictionary *)cl_dictionaryWithPlistData:(NSData *)plist;
+ (NSDictionary *)cl_dictionaryWithURLString:(NSString *)urlString;
- (NSArray *)cl_getAllKeysSorted;
- (NSArray *)cl_getAllValuesSortedByKeys;
- (BOOL)cl_containsObjectForKey:(id)key;
- (NSDictionary *)cl_getDictionaryForKeys:(NSArray *)keys;
複製代碼
針對Foundation
的NSFileManager
進行系統外的方法補充:
+ (BOOL)cl_saveDataCacheWithData:(NSData *)data
identifier:(NSString *)identifier;
+ (BOOL)cl_saveDataCacheWithData:(NSData *)data
cacheName:(NSString *)cacheName
identifier:(NSString *)identifier;
+ (NSData *)cl_getDataCacheWithIdentifier:(NSString *)identifier;
+ (NSData *)cl_getDataCacheWithCacheName:(NSString *)cacheName
identifier:(NSString *)identifier;
+ (BOOL)cl_removeDataWithCache;
+ (BOOL)cl_removeDataWithCacheWithCacheName:(NSString *)cacheName;
+ (BOOL)cl_saveDocumentWithObject:(id)object
fileName:(NSString *)fileName;
+ (BOOL)cl_removeDocumentObjectWithFileName:(NSString *)fileName;
+ (id)cl_getDocumentObjectWithFileName:(NSString *)fileName;
+ (BOOL)cl_checkFileExistWithFilePath:(NSString *)filePath;
+ (NSUInteger)cl_getApplicationDocumentSize;
+ (NSUInteger)cl_getApplicationCacheSize;
+ (NSUInteger)cl_getApplicationLibrarySize;
+ (NSUInteger)cl_getApplicationFileSizeWithFilePath:(NSString *)folderPath;
複製代碼
針對Foundation
的NSMutableArray
進行系統外的方法補充:
- (void)cl_addSafeObject:(id)object;
- (void)cl_insertSafeObject:(id)object
index:(NSUInteger)index;
- (void)cl_safeRemoveObjectAtIndex:(NSUInteger)index;
- (void)cl_safeRemoveObjectsInRange:(NSRange)range;
複製代碼
針對Foundation
的NSMutableAttributedString
進行系統外的方法補充:
+ (NSMutableAttributedString *)cl_attributeStringWithSubffixString:(NSString *)subffixString
subffixImage:(UIImage *)subffixImage;
+ (NSMutableAttributedString *)cl_attributeStringWithSubffixString:(NSString *)subffixString
subffixImages:(NSArray<UIImage *> *)subffixImages;
+ (NSMutableAttributedString *)cl_attributeStringWithPrefixString:(NSString *)prefixString
prefixImage:(UIImage *)prefixImage;
+ (NSMutableAttributedString *)cl_attributeStringWithPrefixString:(NSString *)prefixString
prefixImages:(NSArray<UIImage *> *)prefixImages;
+ (NSMutableAttributedString *)cl_attributedStringWithString:(NSString *)string
lineSpacing:(CGFloat)lineSpacing;
+ (NSMutableAttributedString *)cl_attributedStringWithAttributedString:(NSAttributedString *)attributedString
lineSpacing:(CGFloat)lineSpacing;
+ (NSMutableAttributedString *)cl_attributedStringAddLineWithString:(NSString *)string
range:(NSRange)range;
+ (NSMutableAttributedString *)cl_attributedStringAddLineWithAttributedString:(NSAttributedString *)attributedString
range:(NSRange)range;
複製代碼
針對Foundation
的NSMutableDictionary
進行系統外的方法補充:
- (void)cl_setSafeObject:(id)object
forKey:(id)key;
- (id)cl_safeObjectForKey:(id)key;
- (id)cl_safeKeyForValue:(id)value;
+ (NSMutableDictionary *)cl_mutableDictionaryWithPlistData:(NSData *)plist;
- (NSMutableDictionary *)cl_popEntriesForKeys:(NSArray *)keys;
複製代碼
針對Foundation
的NSNumber
進行系統外的方法補充:
+ (NSString *)cl_displayDecimalWithNumber:(NSNumber *)number
digit:(NSUInteger)digit;
+ (NSString *)cl_displayCurrencyWithNumber:(NSNumber *)number
digit:(NSUInteger)digit;
+ (NSString *)cl_displayPercentWithNumber:(NSNumber *)number
digit:(NSUInteger)digit;
+ (NSNumber *)cl_roundingWithNumber:(NSNumber *)number
digit:(NSUInteger)digit;
+ (NSNumber *)cl_roundCeilingWithNumber:(NSNumber *)number
digit:(NSUInteger)digit;
+ (NSNumber *)cl_roundFloorWithNumber:(NSNumber *)number
digit:(NSUInteger)digit;
複製代碼
針對Foundation
的NSObject
進行系統外的方法補充:
+ (void)cl_exchangeImplementationsWithClass:(Class)class
originalSelector:(SEL)originalSelector
swizzledSelector:(SEL)swizzledSelector;
+ (BOOL)cl_addMethodWithClass:(Class)class
originalSelector:(SEL)originalSelector
swizzledSelector:(SEL)swizzledSelector;
+ (void)cl_replaceMethodWithClass:(Class)class
originalSelector:(SEL)originalSelector
swizzledSelector:(SEL)swizzledSelector;
+ (NSArray <NSString *> *)cl_getClassList;
+ (NSArray <NSString *> *)cl_getClassMethodListWithClass:(Class)class;
+ (NSArray <NSString *> *)cl_getPropertyListWithClass:(Class)class;
+ (NSArray <NSString *> *)cl_getIVarListWithClass:(Class)class;
+ (NSArray <NSString *> *)cl_getProtocolListWithClass:(Class)class;
- (BOOL)cl_hasPropertyWithKey:(NSString *)key;
- (BOOL)cl_hasIvarWithKey:(NSString *)key;
複製代碼
- (void)cl_performAsyncWithComplete:(CLObject)complete;
- (void)cl_performMainThreadWithComplete:(CLObject)complete
isWait:(BOOL)isWait;
- (void)cl_performWithAfterSecond:(NSTimeInterval)afterSecond
complete:(CLObject)complete;
複製代碼
針對Foundation
的NSString
進行系統外的方法補充:
- (CGFloat)cl_heightWithFontSize:(CGFloat)fontSize
width:(CGFloat)width;
+ (CGFloat)cl_measureHeightWithMutilineString:(NSString *)string
font:(UIFont *)font
width:(CGFloat)width;
+ (CGFloat)cl_measureSingleLineStringWidthWithString:(NSString *)string
font:(UIFont *)font;
+ (CGSize)cl_measureStringSizeWithString:(NSString *)string
font:(UIFont *)font;
+ (CGSize)cl_measureStringWithString:(NSString *)string
font:(UIFont *)font
size:(CGSize)size
mode:(NSLineBreakMode)lineBreakMode;
複製代碼
- (NSString *)cl_removeUnwantedZero;
- (NSString *)cl_trimmedString;
- (NSString *)cl_trimmedAllString;
- (NSString *)cl_removeStringCharacterWithCharacter:(NSString *)character;
複製代碼
+ (NSString *)cl_getNumberWithString:(NSString *)string;
+ (NSString *)cl_getSecrectStringWithCardNumber:(NSString *)cardNumber;
+ (NSString *)cl_getSecrectStringWithPhoneNumber:(NSString *)phoneNumber;
+ (NSString *)cl_stringMobileFormat:(NSString *)phoneNumber;
+ (NSString *)cl_stringMobileFormat:(NSString *)phoneNumber
separator:(NSString *)separator;
+ (NSString *)cl_stringUnitFormat:(CGFloat)value
unitString:(NSString *)unitString;
複製代碼
+ (NSString *)cl_base64StringFromData:(NSData *)data
length:(NSUInteger)length;
+ (NSString *)cl_encodingBase64WithString:(NSString *)string;
+ (NSString *)cl_decodedBase64WithString:(NSString *)string;
複製代碼
+ (NSString *)cl_encodingMD2WithString:(NSString *)string;
+ (NSString *)cl_encodingMD4WithString:(NSString *)string;
+ (NSString *)cl_encodingMD5WithString:(NSString *)string;
+ (NSString *)cl_hmacEncodingMD5StringWithString:(NSString *)string
key:(NSString *)key;
複製代碼
+ (NSString *)cl_encodingSHA1WithString:(NSString *)string;
+ (NSString *)cl_hmacEncodingSHA1StringWithString:(NSString *)string
key:(NSString *)key;
+ (NSString *)cl_encodingSHA224WithString:(NSString *)string;
+ (NSString *)cl_hmacEncodingSHA224StringWithString:(NSString *)string
key:(NSString *)key;
+ (NSString *)cl_encodingSHA256WithString:(NSString *)string;
+ (NSString *)cl_hmacEncodingSHA256StringWithString:(NSString *)string
key:(NSString *)key;
+ (NSString *)cl_encodingSHA384WithString:(NSString *)string;
+ (NSString *)cl_hmacEncodingSHA384StringWithString:(NSString *)string
key:(NSString *)key;
+ (NSString *)cl_encodingSHA512WithString:(NSString *)string;
+ (NSString *)cl_hmacEncodingSHA512StringWithString:(NSString *)string
key:(NSString *)key;
複製代碼
+ (NSString *)cl_getFirstCharactorWithString:(NSString *)string;
+ (NSString *)cl_getFirstPinYinWithString:(NSString *)string;
複製代碼
- (BOOL)cl_realContainDecimal;
複製代碼
- (BOOL)cl_isNumber;
- (BOOL)cl_checkMostNumber:(NSInteger)quantity;
- (BOOL)cl_checkAtLeastNumber:(NSInteger)quantity;
- (BOOL)cl_checkLeastNumber:(NSInteger)leastNumber
mostNumber:(NSInteger)mostNumber;
- (BOOL)cl_isNotZeroStartNumber;
- (BOOL)cl_isNotZeroPositiveInteger;
- (BOOL)cl_isNotZeroNegativeInteger;
- (BOOL)cl_isPositiveInteger;
- (BOOL)cl_isNegativeInteger;
複製代碼
- (BOOL)cl_isFloat;
- (BOOL)cl_isPositiveFloat;
- (BOOL)cl_isNagativeFloat;
- (BOOL)cl_isNotZeroStartNumberHaveOneOrTwoDecimal;
- (BOOL)cl_isHaveOneOrTwoDecimalPositiveOrNegative;
- (BOOL)cl_isPositiveRealHaveTwoDecimal;
- (BOOL)cl_isHaveOneOrThreeDecimalPositiveOrNegative;
複製代碼
- (BOOL)cl_isChineseCharacter;
- (BOOL)cl_isEnglishOrNumbers;
- (BOOL)cl_limitinglength:(NSInteger)fistRange
lastRange:(NSInteger)lastRange;
- (BOOL)cl_checkString:(NSInteger)length;
- (BOOL)cl_isLettersString;
- (BOOL)cl_isCapitalLetters;
- (BOOL)cl_isLowercaseLetters;
- (BOOL)cl_isNumbersOrLettersOrLineString;
- (BOOL)cl_isChineseCharacterOrEnglishOrNumbersOrLineString;
- (BOOL)cl_isDoesSpecialCharactersString;
- (BOOL)cl_isContainSpecialCharacterString;
- (BOOL)cl_isContainCharacter:(NSString *)charater;
- (BOOL)cl_isLetterStar;
- (BOOL)cl_checkStringIsStrong;
- (BOOL)cl_checkChineseCharacter;
- (BOOL)cl_checkDoubleByteCharacters;
- (BOOL)cl_checkBlankLines;
- (BOOL)cl_checkFirstAndLastSpaceCharacters;
複製代碼
- (BOOL)cl_checkPhoneNumber;
- (BOOL)cl_checkChinaMobelPhoneNumber;
- (BOOL)cl_checkChinaUnicomPhoneNumber;
- (BOOL)cl_checkChinaTelecomPhoneNumber;
- (BOOL)cl_checkTelePhoneNumber;
- (BOOL)cl_checkFormatTelePhoneNumber;
複製代碼
- (BOOL)cl_checkIdentityCard;
複製代碼
- (BOOL)cl_checkAccount;
- (BOOL)cl_checkPassword;
- (BOOL)cl_checkStrongPassword:(NSInteger)briefest
longest:(NSInteger)longest;
複製代碼
- (BOOL)cl_checkChinaDateFormat;
- (BOOL)cl_checkAbroadDateFormat;
- (BOOL)cl_checkMonth;
- (BOOL)cl_checkDay;
複製代碼
- (BOOL)cl_checkEmailAddress;
- (BOOL)cl_checkDomainName;
- (BOOL)cl_checkURL;
- (BOOL)cl_checkXMLFile;
- (BOOL)cl_checkHTMLSign;
- (BOOL)cl_checkQQNumber;
- (BOOL)cl_checkPostalCode;
- (BOOL)cl_checkIPv4InternetProtocol;
- (BOOL)cl_regularWithRule:(NSString *)rule;
複製代碼
針對Foundation
的NSTimer
進行系統外的方法補充:
+ (NSTimer *)cl_scheduledTimerWithTimeInterval:(NSTimeInterval)timeInterval
repeats:(BOOL)repeats
complete:(CLTimer)complete;
+ (NSTimer *)cl_timerWithTimeInterval:(NSTimeInterval)timeInterval
repeats:(BOOL)repeats
complete:(CLTimer)complete;
- (void)cl_resumeTimer;
- (void)cl_pauseTimer;
- (void)cl_resumeTimerAfterTimeInterval:(NSTimeInterval)timeInterval;
複製代碼
針對Foundation
的NSURL
進行系統外的方法補充:
+ (void)cl_openBrowserWithURL:(NSString *)urlString;
+ (NSURL *)cl_getDocumentFileURL;
+ (NSURL *)cl_getLibraryFileURL;
+ (NSURL *)cl_getCachesFileURL;
+ (NSURL *)cl_getFileURLForDirectory:(NSSearchPathDirectory)directory;
+ (NSString *)cl_getDocumentPathURL;
+ (NSString *)cl_getLibraryPathURL;
+ (NSString *)cl_getCachesPathURL;
+ (NSString *)cl_getPathURLForDirectory:(NSSearchPathDirectory)directory;
複製代碼