-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <[email protected]>
- Loading branch information
1 parent
c9198bb
commit 119f654
Showing
4 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// TODO: A temporary workaround for Xcode 13.3 compiler issue. Should remove after https://bugs.swift.org/browse/SR-15807 is fixed. | ||
import Foundation | ||
import Defaults | ||
|
||
extension Defaults.Serializable where Self: Codable { | ||
public static var bridge: Defaults.TopLevelCodableBridge<Self> { Defaults.TopLevelCodableBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & NSSecureCoding { | ||
public static var bridge: Defaults.CodableNSSecureCodingBridge<Self> { Defaults.CodableNSSecureCodingBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & NSSecureCoding & Defaults.PreferNSSecureCoding { | ||
public static var bridge: Defaults.NSSecureCodingBridge<Self> { Defaults.NSSecureCodingBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & RawRepresentable { | ||
public static var bridge: Defaults.RawRepresentableCodableBridge<Self> { Defaults.RawRepresentableCodableBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & RawRepresentable & Defaults.PreferRawRepresentable { | ||
public static var bridge: Defaults.RawRepresentableBridge<Self> { Defaults.RawRepresentableBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: RawRepresentable { | ||
public static var bridge: Defaults.RawRepresentableBridge<Self> { Defaults.RawRepresentableBridge() } | ||
} | ||
extension Defaults.Serializable where Self: NSSecureCoding { | ||
public static var bridge: Defaults.NSSecureCodingBridge<Self> { Defaults.NSSecureCodingBridge() } | ||
} | ||
|
||
extension Defaults.CollectionSerializable where Element: Defaults.Serializable { | ||
public static var bridge: Defaults.CollectionBridge<Self> { Defaults.CollectionBridge() } | ||
} | ||
|
||
extension Defaults.SetAlgebraSerializable where Element: Defaults.Serializable & Hashable { | ||
public static var bridge: Defaults.SetAlgebraBridge<Self> { Defaults.SetAlgebraBridge() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## Workaround for Xcode 13.3 | ||
|
||
When using `Defaults` with Xcode 13.3, the compiler may complain about `Type 'YourType' does not conform to protocol 'DefaultsSerializable'`. | ||
|
||
[**This is a Swift bug.**](https://bugs.swift.org/projects/SR/issues/SR-15807) | ||
|
||
Workaround: | ||
|
||
1. Create a file named `Defaults+Workaround.swift` in the project using `Defaults`. | ||
2. Copy the below code into `Defaults+Workaround.swift`. | ||
|
||
```swift | ||
import Foundation | ||
import Defaults | ||
|
||
extension Defaults.Serializable where Self: Codable { | ||
public static var bridge: Defaults.TopLevelCodableBridge<Self> { Defaults.TopLevelCodableBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & NSSecureCoding { | ||
public static var bridge: Defaults.CodableNSSecureCodingBridge<Self> { Defaults.CodableNSSecureCodingBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & NSSecureCoding & Defaults.PreferNSSecureCoding { | ||
public static var bridge: Defaults.NSSecureCodingBridge<Self> { Defaults.NSSecureCodingBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & RawRepresentable { | ||
public static var bridge: Defaults.RawRepresentableCodableBridge<Self> { Defaults.RawRepresentableCodableBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: Codable & RawRepresentable & Defaults.PreferRawRepresentable { | ||
public static var bridge: Defaults.RawRepresentableBridge<Self> { Defaults.RawRepresentableBridge() } | ||
} | ||
|
||
extension Defaults.Serializable where Self: RawRepresentable { | ||
public static var bridge: Defaults.RawRepresentableBridge<Self> { Defaults.RawRepresentableBridge() } | ||
} | ||
extension Defaults.Serializable where Self: NSSecureCoding { | ||
public static var bridge: Defaults.NSSecureCodingBridge<Self> { Defaults.NSSecureCodingBridge() } | ||
} | ||
|
||
extension Defaults.CollectionSerializable where Element: Defaults.Serializable { | ||
public static var bridge: Defaults.CollectionBridge<Self> { Defaults.CollectionBridge() } | ||
} | ||
|
||
extension Defaults.SetAlgebraSerializable where Element: Defaults.Serializable & Hashable { | ||
public static var bridge: Defaults.SetAlgebraBridge<Self> { Defaults.SetAlgebraBridge() } | ||
} | ||
``` |