mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-08 10:26:11 +00:00
[swift] small improvements (#19675)
* [swift] small improments * [swift] small improments * [swift] small improments * [swift] make CI pass * [swift] make CI pass * [swift] make CI pass * [swift] make CI pass * [swift] make CI pass * [swift] make CI pass * [swift] make CI pass
This commit is contained in:
@@ -111,7 +111,7 @@ open class Response<T> {
|
||||
}
|
||||
|
||||
public final class RequestTask: @unchecked Sendable {
|
||||
private var lock = NSRecursiveLock()
|
||||
private let lock = NSRecursiveLock()
|
||||
private var task: URLSessionDataTaskProtocol?
|
||||
|
||||
internal func set(task: URLSessionDataTaskProtocol) {
|
||||
|
||||
@@ -9,26 +9,16 @@ import Foundation
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> {
|
||||
|
||||
private var dictionary = [K: V]()
|
||||
private let queue = DispatchQueue(
|
||||
label: "SynchronizedDictionary",
|
||||
qos: DispatchQoS.userInitiated,
|
||||
attributes: [DispatchQueue.Attributes.concurrent],
|
||||
autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit,
|
||||
target: nil
|
||||
)
|
||||
private let lock = NSRecursiveLock()
|
||||
|
||||
internal subscript(key: K) -> V? {
|
||||
get {
|
||||
var value: V?
|
||||
|
||||
queue.sync {
|
||||
value = self.dictionary[key]
|
||||
lock.withLock {
|
||||
self.dictionary[key]
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
set {
|
||||
queue.sync(flags: DispatchWorkItemFlags.barrier) {
|
||||
lock.withLock {
|
||||
self.dictionary[key] = newValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ private class FormDataEncoding: ParameterEncoding {
|
||||
func mimeType(for url: URL) -> String {
|
||||
let pathExtension = url.pathExtension
|
||||
|
||||
if #available(iOS 15, macOS 11, *) {
|
||||
if #available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *) {
|
||||
#if canImport(UniformTypeIdentifiers)
|
||||
if let utType = UTType(filenameExtension: pathExtension) {
|
||||
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||
|
||||
Reference in New Issue
Block a user