[swift] remove urlsession kvo usage (#6211)

This commit is contained in:
Bruno Coelho
2020-05-08 03:13:13 +01:00
committed by GitHub
parent b23ec9a7dd
commit 577ebb687e
52 changed files with 62 additions and 189 deletions

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -305,13 +305,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -567,7 +568,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -265,13 +265,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -519,7 +520,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -265,13 +265,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -519,7 +520,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -265,13 +265,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -519,7 +520,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -265,13 +265,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -519,7 +520,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -305,13 +305,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -567,7 +568,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -265,13 +265,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -519,7 +520,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -265,13 +265,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -519,7 +520,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -305,13 +305,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -567,7 +568,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -265,13 +265,14 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
TargetAttributes = {
};
};
buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Base,
en,
);
mainGroup = 5FBA6AE5F64CD737F88B4565;
@@ -519,7 +520,7 @@
3B2C02AFB91CB5C82766ED5C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
defaultConfigurationName = Debug;
};
ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = {
isa = XCConfigurationList;

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:PetstoreClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -41,10 +41,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
<CodeCoverageTargets>
</CodeCoverageTargets>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -67,8 +63,6 @@
</MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()

View File

@@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -24,8 +24,6 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
let progress = Progress()
private var observation: NSKeyValueObservation?
deinit {
@@ -161,12 +159,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
}
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in
self.progress.totalUnitCount = newProgress.totalUnitCount
self.progress.completedUnitCount = newProgress.completedUnitCount
}
onProgressReady?(progress)
onProgressReady?(dataTask.progress)
}
dataTask.resume()