This package provides extensions to commonly used Foundation
Classes, like Array
and Date
.
Everything is written in Swift, documented and tested.
- Remove duplicate elements.
- Safely return element.
- Initialize Date with ease based on year, month, day, minute and second.
- Execute closure associated with a unique token only once and thread safe.
- Adds
code
anddomain
properties to 'Error'.
- Substitute the color of
NSAttributedString
instance keeping all other attributes. - Substitute the text of
NSAttributedString
instance keeping all other attributes.
- Initialize
String
with the content of a specified url. - Replace fulfilled regex patterns of a
String
with anotherString
. - 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
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/