Reputation: 422
I am currently making a custom framework and there I need to load html files from local folder named "build". I tried to drag and drop, selecting "Create Folder Reference" (only this works, from the picture below, you will see the folder is in blue and not orange as this is due to me clicked "Create Folder Reference" rather than "Create Groups").
After doing this, for a project to run my pod, I need to go in my Build Phase -> Copy Bundle Resources, then manually add the "build" folder. This is because when i push to Github, this "build" folder is missing. My guess is that the reference is gone as I dragged n dropped using "Create Folder Reference". How do we load it in framework, so that user does not need to then drag my "build" folder, Go to Build Phase -> Copy Bundle Resources and add it manually?
In my framework folder, it looks like this:
To know why i need the "build" folder, it is due to my function with the code:
do {
guard let filePath = Bundle.main.path(forResource: "index", ofType: "html", inDirectory: "build")
else {
// File Error
print ("File reading error")
return
}
and the index.html file is found in the "build" folder.
Upvotes: 0
Views: 264
Reputation: 655
Do you have checked the copy items if needed checkbox when you imported the folder? Look up in your target under "CustomFramework" -> Targets: CustomFramework -> "build phases" -> "Copy Bundle Resources" if the files are there. I think the blue folder is just a reference and the files inside are not loaded by Bundle.main.path(...
Upvotes: 1