YYCategories

About YYCategories

YYCategories is a collection of useful categories for Foundation and UIKit classes in Swift.

Installation

You can easily integrate YYCategories into your project using CocoaPods. Simply add the following line to your Podfile:

pod 'YYCategories'

Then run the command:

pod install

If you prefer not to use CocoaPods, you can manually add the Swift files in the following folder to your project:

Pod/Classes

Usage

YYCategories provides extensions to various Foundation and UIKit classes, simplifying common tasks in Swift development.

Foundation Extensions

String+YYAdditions

  • yy_isValidEmail: Convenient method to check if a string is a valid email address.
  • yy_isValidUrl: Convenient method to check if a string is a valid URL.
  • yy_trimmed: Returns a new string by removing whitespace and new line characters from both ends of the original string.
  • yy_base64Encoded: Returns a base64 encoded string.
  • yy_base64Decoded: Returns a base64 decoded string.
  • yy_md2String: Returns the MD2 hash value as a string.
  • yy_md4String: Returns the MD4 hash value as a string.
  • yy_md5String: Returns the MD5 hash value as a string.
  • yy_sha1String: Returns the SHA1 hash value as a string.
  • yy_sha224String: Returns the SHA224 hash value as a string.
  • yy_sha256String: Returns the SHA256 hash value as a string.
  • yy_sha384String: Returns the SHA384 hash value as a string.
  • yy_sha512String: Returns the SHA512 hash value as a string.

UIKit Extensions

UIApplication+YYAdditions

  • yy_applicationSize: Returns the size of the application window.
  • yy_isPirated: Checks if the app is run on a pirated or modified environment.
  • yy_benchmark: Measures the time and prints a benchmark log.

UIColor+YYAdditions

  • yy_color: Creates a UIColor object with a hex string.
  • yy_randomColor: Returns a random color.

UIDevice+YYAdditions

  • yy_isiPad: Checks if the device is an iPad.

Contribution

Contributions are welcome! If you find any bug, issue, or have a feature request, please submit an issue or pull request on the GitHub repository.

License

YYCategories is released under the MIT license. See the LICENSE file for more details.