From 5cf1178d34291cac3c004aabcad23f11c40b856e Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 28 Nov 2022 14:17:10 +0700 Subject: [PATCH] Make it possible to import the package once for a whole project (#125) --- Sources/Defaults/Defaults.swift | 3 +++ Sources/Defaults/Documentation.docc/Documentation.md | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/Sources/Defaults/Defaults.swift b/Sources/Defaults/Defaults.swift index e34f959..e6f807f 100644 --- a/Sources/Defaults/Defaults.swift +++ b/Sources/Defaults/Defaults.swift @@ -35,6 +35,9 @@ public enum Defaults { } } +public typealias _Defaults = Defaults +public typealias _Default = Default + extension Defaults { // We cannot use `Key` as the container for keys because of "Static stored properties not supported in generic types". /** diff --git a/Sources/Defaults/Documentation.docc/Documentation.md b/Sources/Defaults/Documentation.docc/Documentation.md index 8a3bf3d..06ab534 100644 --- a/Sources/Defaults/Documentation.docc/Documentation.md +++ b/Sources/Defaults/Documentation.docc/Documentation.md @@ -30,6 +30,17 @@ Defaults[.quality] = 0.5 [Learn More](https://github.com/sindresorhus/Defaults#usage) +### Tip + +If you don't want to import this package in every file you use it, add the below to a file in your app. You can then use `Defaults` and `@Default` from anywhere without an import. + +```swift +import Defaults + +typealias Defaults = _Defaults +typealias Default = _Default +``` + ## Topics ### Essentials