FHPropertyWrappers
Some useful Swift Property Wrappers.
Will be expanded over time.
Requirements
- macOS 10.10+
- iOS 9.0+
- tvOS 9.0+
Installation
Swift Package Manager
Add the following to the dependencies of your Package.swift
:
Manual
Download the files in the Sources folder and drag them into you project.
Stored
A property wrapper which reads and writes the wrapped value in the UserDefaults
store.
It supports all the types that are allowed by UserDefaults
.
Check all the supported types here.
The default value is based on the
defaultStoredValue
if nothing is set.
In addition to that, Optional
, RawRepresentable
and Codable
are supported too.
For non-RawRepresentable
enums use Codable
.
The wrapped value must conform to
Storable
.
SecureStored
A property wrapper which reads and writes the wrapped value in the Keychain
.
It supports all the base types, most of them rely on Codable
.
Check all the supported types here.
The default value is based on the
defaultStoredValue
if nothing is set.
In addition to that, Optional
, RawRepresentable
and Codable
are supported too.
For non-RawRepresentable
enums use Codable
.
The wrapped value must conform to
SecureStorable
.