AIUIKit 1.3.1

AIUIKit 1.3.1

Maintained by Adrian Ilie.



AIUIKit 1.3.1

AIUIKit

Version License Platform

AIUIKit is a collection of methods that can help building the user interface of almost any iOS application. It's main features include:

  • UIColor creation using HEX color codes
  • HTML string filtering
  • Strings trimming and size calculation required for rendering
  • UIImage creation using vector fonts

Requirements

  • Swift 5.0
  • iOS >= 10.0

Installation

AIUIKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AIUIKit'

Usage

Replace application root view controller
AIUIKit.replaceRootViewController(viewController: UIViewController)

UIColor

All UIColor methods are implemented as an extension on UIColor class.

Creating UIColor using HEX code
UIColor(hex: String, alpha: CGFloat? = 1.0)

String

All string methods are implemented as an extension on String class.

HTML tags removal from a string
stringInstance.htmlTagsFiltered()
Trimming string to specified length
stringInstance.trimToLength(length: Int)
Calculate visibile part of a string when rendered
stringInstance.visible(inSize size: CGSize, withFont font: UIFont)
Calculate height to display a string
stringInstance.requiredHeightToDisplay(forWidth width: CGFloat, withFont font: UIFont)

UIFont

Printing to console all fonts available in the app
UIFont.printAvailableFonts()

UIImage

All UIImage methods are implemented as an extension on UIImage class.

Create transparent image
UIImage(size: CGSize)
Create colored image
UIImage(size: CGSize, color: UIColor)
Create image with contents of a view
UIImage(ofView view: UIView)
Create image with contents of a string
UIImage(size: CGSize, font: UIFont, color: UIColor, content: String)

CGSize

All CGSize methods are implemented as an extension on CGSize struct.

Resize to fit in a maximum size while maintaining the aspect ratio
sizeStruct.resize(toMaximumSize size: CGSize)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

License

AIUIKit is available under the MIT license. See the LICENSE file for more info.

Author

Adrian Ilie, [email protected]