This is a little holding place for common tools and conveniences that I like to use in my personal projects.
If anyone ever finds and uses this, I'd love to hear any feedback.
OSLog.Logger
:
init(_:)
, which uses the process name and bundle name for the logger's subsystem
, and the provided string for the category
.Int
:
of<Value>(_ value: @autoclosure () throws -> Value) rethrows -> [Value])
: fills an array with self values by executing the provided closure self times.times(_ execute: @autoclosure () throws -> Void) rethrows
: executes the provided closure self times.String
:
randomTitle(wordCount:)
: generates a randomized Title Case string a specified number of words long.Calendar
:
days(from:to:)
: computes a distance, in days, between two dates. Accounts for partial days.cardinalComponents(from:to:)
computes a distance, in years, months, and days, between two dates. Accounts for partial days.Result
:
*static func success()
: a wrapper for the uglier .success(())
Keychain
: A simplistic wrapper for storing single String
values into the user's keychain. Uses the kSecClassGenericPassword
item class.KeychainStorage
: A property wrapper that uses the Keychain
convenience to wrap properties that use the user's keychain for their storage.ReadersWriterLocked
: A property wrapper for making values thread-safe for access using a queue-based readers-writer lock.UserDefault
: A property wrapper that uses UserDefaults
for storage. Requires that the property's type is Optional
and Codable
.link |
Stars: 0 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics