Skip to content

Commit

Permalink
Make load function public.
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay-luassat committed Jun 29, 2024
1 parent 37044e3 commit 6e72fb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/WrkstrmFoundation/JSON/JSONResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ extension WrkstrmMain.JSON {
/// then attempts to load the file's content as `Data`.
///
/// - Parameter fileName: The name of the JSON file to load (without the `.json` extension).
/// - Parameter relativeToFilePath: The relative file path to load the resource from. By default, from
/// the calling file.
/// - Returns: The `Data` content of the JSON file if it exists, or `nil` if an error occurs.
static func load(fileName: String) -> Data? {
public static func load(fileName: String, relativeToFilePath file: String = #file) -> Data? {
// URL of the current file
let currentFileURL = URL(fileURLWithPath: #file)
let currentFileURL = URL(fileURLWithPath: file)

// Directory URL by deleting the last path component from the current file's URL
let currentDirectoryURL = currentFileURL.deletingLastPathComponent()
Expand Down

0 comments on commit 6e72fb8

Please sign in to comment.