Swiftpack.co -  apploft/APLFoundationExtensions as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Useful extensions to Apple Foundation classes
.package(url: "https://github.com/apploft/APLFoundationExtensions.git", from: "3.0.0")


This package provides extensions to commonly used Foundation Classes, like Array and Date.

Everything is written in Swift, documented and tested.

Table of Contents

Overview of Classes and Functionalities

Array Extension

  • Remove duplicate elements.
  • Safely return element.

Date Extension

  • Initialize Date with ease based on year, month, day, minute and second.

DispatchQueue Extension

  • Execute closure associated with a unique token only once and thread safe.

Error Extension

  • Adds code and domain properties to 'Error'.

NSAttributedString Extension

  • Substitute the color of NSAttributedString instance keeping all other attributes.
  • Substitute the text of NSAttributedString instance keeping all other attributes.

String Extension

  • Initialize String with the content of a specified url.
  • Replace fulfilled regex patterns of a String with another String.
  • Determine the capture groups for a given regex.


  • Synchronously load data.


A property wrapper for easy access on UserDefault-backed values. See also https://nshipster.com/propertywrapper/

// Define a UserDefault backed value
@UserDefault("MyValue", defaultValue: true)
static var myValue: Bool


// value will be written to the UserDefaults
myValue = false 


Swift Package

Just integrate the APLFoundationExtension via Xcode 11 (tutorial).


After importing APLFoundationExtension all extensions and documentation can be accessed the default way.

An example of using the method subscript(safe: Index) of the Array extension:

import APLFoundationExtension

let array = ["a", "b"]
array[safe: 100] // returns nil


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


Stars: 0
Last commit: 37 weeks 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.

Release Notes

Remove extension Date init
37 weeks ago

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