Created
July 24, 2021 05:08
-
-
Save ykpoh/ba60b025d3cc84db0973d8476b109a88 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import Foundation | |
| import XCTest | |
| extension Data { | |
| public static func fromJSON(fileName: String) throws -> Data { | |
| let bundle = Bundle(for: TestBundleClass.self) | |
| let url = try XCTUnwrap(bundle.url(forResource: fileName, withExtension: "json")) | |
| return try Data(contentsOf: url) | |
| } | |
| } | |
| private class TestBundleClass { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment