Action Utilities

Action Utilities provide several useful functions that are common across many apps written in Swift and Xcode. These include features such as getting the version of the OS installed on the device the app is running on, testing to see if an app can connect to the internet and getting the device type (for example iPhoneX).

Additionally, many built-in types (such as UIColor, String and Data) have been extended with useful features such as converting a color to and from a hex string and moving images easily between Data and String types to support Swift 4’s Codable protocol.

Action Utilities are support on iOS, tvOS, watchOS and macOS.

Action Extensions

Action Extensions provide several useful features to common, built-in Cocoa, Cocoa Touch and Swift data types such as converting UIColor/NSColor to/from hex strings (for example #FF0000), creating UIImage/NSImage instances from Base64 encoded strings stored in Data or NSData objects and encoding UIImages/NSImages as Base64 strings or Data objects.

iOS Examples:

// Assign a color from a string
let color: UIColor ~= "#FF0000"

// Initialize a color from a hex string
let green = UIColor(fromHex: "00FF00")

// Convert color to a hex string
let white = UIColor.white.toHex()

macOS Examples:

// Assign a color from a string
let color: NSColor ~= "#FF0000"

// Initialize a color from a hex string
let green = NSColor(fromHex: "00FF00")

// Convert color to a hex string
let white = NSColor.white.toHex()

General Utilities

General Utilities provide several, general utility classes to handle thing such as simple popup notifications.

Examples:

// Display popup message at the bottom of the screen
ACNotify.showMessage(text: "Hello World!")

Hardware Utilities

Hardware Utilities provide commonly used information about the device an app is running on such as the device type (for example iPhoneX), the OS version (for example iOS 11.1) and if the app can connect to the internet.

Examples:

if HardwareInformation.deviceType == .iPhoneX {
    // The app is running on an iPhone X
    ...
}

if HardwareInformation.isConnectedToNetwork {
    // The device has an internet connection
    ...
}