-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow URLs with Unicode Characters (#44)
* Adding Support for "Unicode URL" #43 * Adding support for Swift 5.8
- Loading branch information
Showing
11 changed files
with
1,246 additions
and
18 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
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
{} | ||
retain_public: true | ||
targets: | ||
- SyndiKit |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Faire/[email protected] | ||
nicklockwood/[email protected] | ||
realm/[email protected] | ||
peripheryapp/periphery@2.10.0 | ||
peripheryapp/periphery@2.12.3 |
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,16 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "XMLCoder", | ||
"repositoryURL": "https://github.com/CoreOffice/XMLCoder", | ||
"state": { | ||
"branch": null, | ||
"revision": "666227de3b4cf4adcce7c70b8b89f98c7df02754", | ||
"version": "0.16.0" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
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
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,35 @@ | ||
import Foundation | ||
|
||
internal struct UTF8EncodedURL: Codable { | ||
internal let value: URL | ||
internal let string: String? | ||
|
||
internal init(from decoder: Decoder) throws { | ||
let container = try decoder.singleValueContainer() | ||
do { | ||
value = try container.decode(URL.self) | ||
string = nil | ||
} catch let error as DecodingError { | ||
let string = try container.decode(String.self) | ||
|
||
let encodedURLString = string.addingPercentEncoding( | ||
withAllowedCharacters: .urlQueryAllowed | ||
) | ||
let encodedURL = encodedURLString.flatMap(URL.init(string:)) | ||
guard let encodedURL = encodedURL else { | ||
throw error | ||
} | ||
value = encodedURL | ||
self.string = string | ||
} | ||
} | ||
|
||
internal func encode(to encoder: Encoder) throws { | ||
var container = encoder.singleValueContainer() | ||
if let string = string { | ||
try container.encode(string) | ||
} else { | ||
try container.encode(value) | ||
} | ||
} | ||
} |
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