Skip to content

Commit

Permalink
fix: resolve Xcode 15 network runtime warning (#129) (#130)
Browse files Browse the repository at this point in the history
* fix: resolve Xcode 15 network runtime warning (#129)

* podspec version bump

* tests updated

* libraryVersion updated

---------

Co-authored-by: Alex Perathoner <31958579+AlexPerathoner@users.noreply.github.com>
  • Loading branch information
makoni and AlexPerathoner authored Feb 27, 2024
1 parent 3ab0706 commit ce7a27e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Sources/Uploadcare/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal let RESTAPIHost = "api.uploadcare.com"
/// Library name
internal let libraryName = "UploadcareSwift"
/// Library version
internal let libraryVersion = "0.13.0"
internal let libraryVersion = "0.13.1"

/// API version
internal let APIVersion = "0.7"
6 changes: 4 additions & 2 deletions Sources/Uploadcare/UploadAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,16 @@ extension UploadAPI {
_ onProgress: TaskProgressBlock? = nil,
_ completionHandler: @escaping TaskResultCompletionHandler
) -> UploadTaskable {
let urlRequest = createDirectUploadRequest(files: files, store: store, metadata: metadata, uploadSignature: uploadSignature)
var urlRequest = createDirectUploadRequest(files: files, store: store, metadata: metadata, uploadSignature: uploadSignature)

// writing data to temp file
let tempDir = FileManager.default.temporaryDirectory
let localURL = tempDir.appendingPathComponent(UUID().uuidString)

if let data = urlRequest.httpBody {
try? data.write(to: localURL)
// To avoid a runtime warning in Xcode 15, the given `URLRequest` should have a nil `HTTPBody`
urlRequest.httpBody = nil
}

let uploadTask: URLSessionUploadTask
Expand Down Expand Up @@ -640,7 +642,7 @@ extension UploadAPI {
/// - completionHandler: Completion handler.
#if !os(Linux)
@discardableResult
internal func directUploadInForeground(
public func directUploadInForeground(
files: [String: Data],
store: StoringBehavior? = nil,
metadata: [String: String]? = nil,
Expand Down
14 changes: 7 additions & 7 deletions Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {

let list = try await filesList.get(withQuery: query)
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
XCTFail()
XCTFail("No images found")
return
}

Expand Down Expand Up @@ -469,7 +469,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {

let list = try await filesList.get(withQuery: query)
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
XCTFail()
XCTFail("No images found")
return
}

Expand All @@ -488,7 +488,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {

let list = try await filesList.get(withQuery: query)
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
XCTFail()
XCTFail("No images found")
return
}

Expand All @@ -506,7 +506,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {

let list = try await filesList.get(withQuery: query)
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
XCTFail()
XCTFail("No images found")
return
}

Expand All @@ -521,7 +521,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {

let list = try await filesList.get(withQuery: query)
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
XCTFail()
XCTFail("No images found")
return
}

Expand All @@ -536,7 +536,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {

let list = try await filesList.get(withQuery: query)
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
XCTFail()
XCTFail("No images found")
return
}

Expand All @@ -552,7 +552,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {

let list = try await filesList.get(withQuery: query)
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
XCTFail()
XCTFail("No images found")
return
}

Expand Down
2 changes: 1 addition & 1 deletion Uploadcare.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Uploadcare'
s.version = '0.13.0'
s.version = '0.13.1'
s.summary = 'Swift integration for Uploadcare'

# This description is used to generate tags and improve search results.
Expand Down

0 comments on commit ce7a27e

Please sign in to comment.