Swiftpack.co - apploft/APLFoundationExtensions as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by apploft.
apploft/APLFoundationExtensions 3.0.0
Useful extensions to Apple Foundation classes
⭐️ 0
🕓 2 years ago
.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: 2 years ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Remove extension Date init
2 years ago

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