Swiftpack.co - apploft/APLUIKitExtension as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Useful UIKit Extension
.package(url: "https://github.com/apploft/APLUIKitExtension.git", from: "1.2.6")


This package provides extensions and subclasses to commonly used UIKit Classes, like UIColor and UIViewController. Everything is written in Swift, documented and tested. This package is restricted to the iOS platfrom.

Table of Contents

Overview of Classes and Functionalities

In the following an overview of all subclasses/extended classes and their functionalities:

AutoMaxLayoutWidthLabel (subclass of UILabel)

  • Automaticly scales the label to its maximal needed size based on its content view.

DefaultTabBarControllerDelegate (subclass of UITabBarControllerDelegate)

  • Perform an action in a view controller if the corresponding tab bar item is selected again.

NibLoadable (extension for UIView)

  • Generates a nib, nibName and nibInstance of a view. Mainly usefull for UITableViewCell and UICollectionViewCell.

ReusableView (extension for UIView)

  • Generate a resuable identifier.

StoryboardLoadable (extension for UIViewController)

  • Generate storyboardName and storyboardIdentifier.
  • Methods to instantiate a UIViewController with either a storyboard name or a storyboard object.
  • Methods to instantiate the initial view controller from either a storyboard name or a storyboard object.

UIBarButtonBadge Extention

  • Create and update a Badge.

UIButton Extension

  • Set the background to a color, a gradient color, or a rounded image.

UICollectionView Extension

  • Given a view determine the index path of the corresponding collection view cell.

UIColor Extension

  • Blend colors together
  • lighter color
  • darker color
  • adjust color
  • generate image from color
  • generate hexstring

UIControl Extension

  • Enable adding actions to buttons the swity way.

UIDevice Extension

  • Generate the model identifier of the used device.

UIImage Extension

  • Generate a gradient image.

UIResponder Extension

  • Get the current first responder.

UITableView Extension

  • Given a view determine the index path of the corresponding table view cell.

UIView Extension

  • Add Swifty way of adding constrains.
  • Add inspectable elements for interface builder:
    • cornerRadius
    • cornerIsCircle
    • borderWidth
    • borderColor
    • shadowOffset
    • shadowRadius
    • shadowOpacity
    • layerShadowColor

UIViewController Extension

  • Determine the top visible view controller.
  • Create different types of UIAlertController with ease.
  • Manage back button behaviour in navigation bar.
  • Wrapper to embed and unembed view controller into each other.


Swift Package

Just integrate the APLUIKitExtension via Xcode 11 (tutorial).


After importing APLUIKitExtension all classes, extensions and documentation can be accessed the default way.

An example of using the method darker() of the UIColor extension:

import APLUIKitExtension

let redColor = UIColor.red
let darkerRedColor = redColor.darker()

An example of using the class 'AutoMaxLayoutWidthLabel':

import APLUIKitExtension

let label = AutoMaxLayoutWidthLabel(frame: .zero)


APLUIKitExtension is created by apploft on 02.04.2020. Copyright © 2019 apploft GmbH MIT License · http://choosealicense.com/licenses/mit/


Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

1 year ago

Add a new setBadge function to UIBarButtonBadge.swift which allows more customization.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics