Summary
Using the example syntax found in the Readme when defining archive it results in the following error:
Errors thrown from here are not handled
Steps to Reproduce
let archive = try Archive(url: archiveURL, accessMode: .update)
Expected Results
No error
Actual Results
Error
What does work
When experimenting with this I referred to ZIPFoundationModerns implementation.
In Archive.swift if I change:
public init(url: URL, accessMode mode: AccessMode, pathEncoding: String.Encoding? = nil) throws {
to
public init?(url: URL, accessMode mode: AccessMode, pathEncoding: String.Encoding? = nil) throws {
I can then use:
guard let archive = try? Archive(url: archiveURL, accessMode: .update) else {
return
}
Without error
Note:
I am no expert in Swift and I don't know the consequences of this change but I am just informing you that that works - for me.
I noticed that the current Archive INIT does not actually include any throws within the function itself... so I am not sure hoiw it would return nil - as the documentation states.
Once again, when referring to the ZIPFoundationModern code it includes the following in the INIT:
guard let config = Archive.makeBackingConfiguration(for: url, mode: mode) else {
return nil
}
``
Also.... just to be a pain in the neck... the Archive.swift source code documentation has not been updated to reflect the latest code changes - you probably already know this. This is not important to me but is just an observation.
Summary
Using the example syntax found in the Readme when defining archive it results in the following error:
Steps to Reproduce
let archive = try Archive(url: archiveURL, accessMode: .update)
Expected Results
No error
Actual Results
Error
What does work
When experimenting with this I referred to ZIPFoundationModerns implementation.
In Archive.swift if I change:
to
I can then use:
Without error
Note:
I am no expert in Swift and I don't know the consequences of this change but I am just informing you that that works - for me.
I noticed that the current Archive INIT does not actually include any throws within the function itself... so I am not sure hoiw it would return nil - as the documentation states.
Once again, when referring to the ZIPFoundationModern code it includes the following in the INIT: