Make it possible to import the package once for a whole project (#125)

This commit is contained in:
Sindre Sorhus 2022-11-28 14:17:10 +07:00 committed by GitHub
parent 7a22d37874
commit 5cf1178d34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -35,6 +35,9 @@ public enum Defaults {
} }
} }
public typealias _Defaults = Defaults
public typealias _Default = Default
extension Defaults { extension Defaults {
// We cannot use `Key` as the container for keys because of "Static stored properties not supported in generic types". // We cannot use `Key` as the container for keys because of "Static stored properties not supported in generic types".
/** /**

View File

@ -30,6 +30,17 @@ Defaults[.quality] = 0.5
[Learn More](https://github.com/sindresorhus/Defaults#usage) [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 ## Topics
### Essentials ### Essentials