diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
similarity index 100%
rename from ISSUE_TEMPLATE.md
rename to .github/ISSUE_TEMPLATE.md
diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
similarity index 100%
rename from PULL_REQUEST_TEMPLATE.md
rename to .github/PULL_REQUEST_TEMPLATE.md
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..3b4551c
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,28 @@
+name: "AlamofireNetworkActivityIndicator CI"
+
+on:
+ push:
+ branches:
+ - master
+ - hotfix
+ pull_request:
+ branches:
+ - master
+ - hotfix
+
+jobs:
+ iOS:
+ name: Test iOS
+ runs-on: macOS-latest
+ env:
+ DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer
+ strategy:
+ matrix:
+ destination: ["OS=13.3,name=iPhone 11 Pro"]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v1
+ - name: Dependencies
+ run: carthage bootstrap --no-use-binaries --platform iOS
+ - name: iOS
+ run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "AlamofireNetworkActivityIndicator.xcodeproj" -scheme "AlamofireNetworkActivityIndicator" -destination "${{ matrix.destination }}" clean test | xcpretty
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index b07b6de..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "Carthage/Checkouts/Alamofire"]
- path = Carthage/Checkouts/Alamofire
- url = https://github.com/Alamofire/Alamofire.git
diff --git a/.ruby-version b/.ruby-version
index 59aa62c..24ba9a3 100644
--- a/.ruby-version
+++ b/.ruby-version
@@ -1 +1 @@
-2.4.5
+2.7.0
diff --git a/.swiftformat b/.swiftformat
new file mode 100644
index 0000000..4cebd29
--- /dev/null
+++ b/.swiftformat
@@ -0,0 +1,26 @@
+# file options
+
+--symlinks ignore
+--exclude Carthage
+--swiftversion 5
+
+# rules
+--disable andOperator
+
+# format options
+
+--closingparen same-line
+--commas inline
+--comments indent
+--decimalgrouping 3,5
+--exponentcase lowercase
+--exponentgrouping disabled
+--fractiongrouping disabled
+--ifdef outdent
+--importgrouping testable-top
+--operatorfunc no-space
+--nospaceoperators ..<, ...
+--selfrequired validate
+--stripunusedargs closure-only
+--wraparguments after-first
+--wrapcollections after-first
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index cd89df6..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-os: osx
-osx_image: xcode10.2
-branches:
- only:
- - master
-env:
- global:
- - LC_CTYPE=en_US.UTF-8
- - LANG=en_US.UTF-8
- - PROJECT=AlamofireNetworkActivityIndicator.xcodeproj
- - SCHEME="AlamofireNetworkActivityIndicator"
- matrix:
- - DESTINATION="OS=12.2,name=iPhone X" POD_LINT="YES"
- - DESTINATION="OS=11.4,name=iPhone 8" POD_LINT="NO"
- - DESTINATION="OS=10.3.1,name=iPhone 7" POD_LINT="NO"
- - DESTINATION="OS=9.3,name=iPhone 6" POD_LINT="NO"
-script:
- - set -o pipefail
- - git submodule update --init --recursive
- - pod repo update
- - xcodebuild -version
- - xcodebuild -showsdks
-
- # Build Framework in Debug and Run Tests
- - xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty -c;
-
- # Build Framework in Release and Run Tests
- - xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty -c;
-
- # Run `pod lib lint` if specified
- - if [ $POD_LINT == "YES" ]; then
- pod lib lint;
- fi
diff --git a/AlamofireNetworkActivityIndicator.podspec b/AlamofireNetworkActivityIndicator.podspec
index be1a75b..65b20d5 100644
--- a/AlamofireNetworkActivityIndicator.podspec
+++ b/AlamofireNetworkActivityIndicator.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AlamofireNetworkActivityIndicator'
- s.version = '3.0.0-beta.3'
+ s.version = '3.0.0'
s.license = 'MIT'
s.summary = 'Controls the visibility of the network activity indicator on iOS using Alamofire'
s.homepage = 'https://github.com/Alamofire/AlamofireNetworkActivityIndicator'
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '10.0'
- s.swift_version = '5.0'
+ s.swift_versions = ['5.0', '5.1']
- s.dependency 'Alamofire', '~> 5.0.0-beta.6'
+ s.dependency 'Alamofire', '~> 5.0'
end
diff --git a/AlamofireNetworkActivityIndicator.xcodeproj/project.pbxproj b/AlamofireNetworkActivityIndicator.xcodeproj/project.pbxproj
index 5fb598b..2e9c73c 100644
--- a/AlamofireNetworkActivityIndicator.xcodeproj/project.pbxproj
+++ b/AlamofireNetworkActivityIndicator.xcodeproj/project.pbxproj
@@ -95,6 +95,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 311AAFCC23FB4CDF00AFBABD /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; };
4C0097AC1EF4CB9A0010778C /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; };
4C0097AD1EF4CB9A0010778C /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = ""; };
4C0097AE1EF4CB9A0010778C /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; };
@@ -145,6 +146,7 @@
children = (
4C0097B01EF4CBA40010778C /* AlamofireNetworkActivityIndicator.podspec */,
4C0097B11EF4CBA40010778C /* Cartfile */,
+ 311AAFCC23FB4CDF00AFBABD /* Package.swift */,
);
name = Deployment;
sourceTree = "";
@@ -296,11 +298,11 @@
};
buildConfigurationList = 4CB928331C66E1A600CE5F08 /* Build configuration list for PBXProject "AlamofireNetworkActivityIndicator" */;
compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
+ developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
- English,
en,
+ Base,
);
mainGroup = 4CB9282F1C66E1A600CE5F08;
productRefGroup = 4CB9283A1C66E1A600CE5F08 /* Products */;
diff --git a/AlamofireNetworkActivityIndicator.xcodeproj/xcshareddata/xcschemes/AlamofireNetworkActivityIndicator.xcscheme b/AlamofireNetworkActivityIndicator.xcodeproj/xcshareddata/xcschemes/AlamofireNetworkActivityIndicator.xcscheme
index a58f04d..c33a52d 100644
--- a/AlamofireNetworkActivityIndicator.xcodeproj/xcshareddata/xcschemes/AlamofireNetworkActivityIndicator.xcscheme
+++ b/AlamofireNetworkActivityIndicator.xcodeproj/xcshareddata/xcschemes/AlamofireNetworkActivityIndicator.xcscheme
@@ -40,8 +40,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- enableThreadSanitizer = "YES"
- shouldUseLaunchSchemeArgsEnv = "YES">
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ enableThreadSanitizer = "YES">
+
+
+
+
@@ -54,17 +63,6 @@
-
-
-
-
-
-
-
-
5.0.0-beta.6
+github "Alamofire/Alamofire" ~> 5.0
diff --git a/Cartfile.resolved b/Cartfile.resolved
index 5dbf8f1..e8557b4 100644
--- a/Cartfile.resolved
+++ b/Cartfile.resolved
@@ -1 +1 @@
-github "Alamofire/Alamofire" "5.0.0-beta.6"
+github "Alamofire/Alamofire" "5.0.0"
diff --git a/Carthage/Checkouts/Alamofire b/Carthage/Checkouts/Alamofire
index 163db02..0c8cb78 160000
--- a/Carthage/Checkouts/Alamofire
+++ b/Carthage/Checkouts/Alamofire
@@ -1 +1 @@
-Subproject commit 163db02519e6f89dcbc57126bd5b17f729b81988
+Subproject commit 0c8cb78d05b6d067ee331c05058ff4dedcb45ffa
diff --git a/Gemfile b/Gemfile
index 18598ed..b319c4f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,3 +2,4 @@ source "https://rubygems.org"
gem "cocoapods"
gem "jazzy"
+gem "xcpretty"
diff --git a/Gemfile.lock b/Gemfile.lock
index b956749..bd75805 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,96 +1,99 @@
GEM
remote: https://rubygems.org/
specs:
- CFPropertyList (3.0.0)
+ CFPropertyList (3.0.2)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
+ algoliasearch (1.27.1)
+ httpclient (~> 2.8, >= 2.8.3)
+ json (>= 1.5.1)
atomos (0.1.3)
- claide (1.0.2)
- cocoapods (1.6.1)
+ claide (1.0.3)
+ cocoapods (1.8.4)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
- cocoapods-core (= 1.6.1)
- cocoapods-deintegrate (>= 1.0.2, < 2.0)
+ cocoapods-core (= 1.8.4)
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
- cocoapods-trunk (>= 1.3.1, < 2.0)
+ cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
- fourflusher (>= 2.2.0, < 3.0)
+ fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.4)
- xcodeproj (>= 1.8.1, < 2.0)
- cocoapods-core (1.6.1)
+ xcodeproj (>= 1.11.1, < 2.0)
+ cocoapods-core (1.8.4)
activesupport (>= 4.0.2, < 6)
+ algoliasearch (~> 1.0)
+ concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
- cocoapods-downloader (1.2.2)
+ cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
- cocoapods-trunk (1.3.1)
+ cocoapods-trunk (1.4.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
- concurrent-ruby (1.1.5)
+ concurrent-ruby (1.1.6)
escape (0.0.4)
- ffi (1.10.0)
- fourflusher (2.2.0)
+ ffi (1.12.2)
+ fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
+ httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
- jazzy (0.9.4)
- cocoapods (~> 1.0)
- mustache (~> 0.99)
+ jazzy (0.13.1)
+ cocoapods (~> 1.5)
+ mustache (~> 1.1)
open4
- redcarpet (~> 3.2)
+ redcarpet (~> 3.4)
rouge (>= 2.0.6, < 4.0)
- sass (~> 3.4)
+ sassc (~> 2.1)
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
+ json (2.3.0)
liferaft (0.0.6)
- minitest (5.11.3)
+ minitest (5.14.0)
molinillo (0.6.6)
- mustache (0.99.8)
+ mustache (1.1.1)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
open4 (1.3.4)
- rb-fsevent (0.10.3)
- rb-inotify (0.10.0)
- ffi (~> 1.0)
- redcarpet (3.4.0)
- rouge (3.3.0)
+ redcarpet (3.5.0)
+ rouge (2.0.7)
ruby-macho (1.4.0)
- sass (3.7.4)
- sass-listen (~> 4.0.0)
- sass-listen (4.0.0)
- rb-fsevent (~> 0.9, >= 0.9.4)
- rb-inotify (~> 0.9, >= 0.9.7)
- sqlite3 (1.4.0)
+ sassc (2.2.1)
+ ffi (~> 1.9)
+ sqlite3 (1.4.2)
thread_safe (0.3.6)
- tzinfo (1.2.5)
+ tzinfo (1.2.6)
thread_safe (~> 0.1)
xcinvoke (0.3.0)
liferaft (~> 0.0.6)
- xcodeproj (1.8.2)
+ xcodeproj (1.15.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.6)
+ xcpretty (0.3.0)
+ rouge (~> 2.0.7)
PLATFORMS
ruby
@@ -98,6 +101,7 @@ PLATFORMS
DEPENDENCIES
cocoapods
jazzy
+ xcpretty
BUNDLED WITH
- 1.17.3
+ 2.1.2
diff --git a/Package.swift b/Package.swift
index 62a63c9..14ec451 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,20 +1,10 @@
// swift-tools-version:5.1
import PackageDescription
-let package = Package(
- name: "AlamofireNetworkActivityIndicator",
- platforms: [.iOS(.v10)],
- products: [
- .library(name: "AlamofireNetworkActivityIndicator", targets: ["AlamofireNetworkActivityIndicator"]),
- ],
- dependencies: [
- .package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.0.0-rc.3")
- ],
- targets: [
- .target(
- name: "AlamofireNetworkActivityIndicator",
- dependencies: ["Alamofire"],
- path: "Source"
- ),
- ]
-)
+let package = Package(name: "AlamofireNetworkActivityIndicator",
+ platforms: [.iOS(.v10)],
+ products: [.library(name: "AlamofireNetworkActivityIndicator", targets: ["AlamofireNetworkActivityIndicator"])],
+ dependencies: [.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.0.0")],
+ targets: [.target(name: "AlamofireNetworkActivityIndicator",
+ dependencies: ["Alamofire"],
+ path: "Source")])
diff --git a/README.md b/README.md
index 1f36d9e..41ffd1e 100644
--- a/README.md
+++ b/README.md
@@ -18,13 +18,13 @@ Controls the visibility of the network activity indicator on iOS using Alamofire
## Requirements
-- iOS 8.0+
-- Xcode 9.0+
-- Swift 4.0+
+- iOS 10.0+
+- Xcode 10.2+
+- Swift 5.0+
## Dependencies
-- [Alamofire 4.8+](https://github.com/Alamofire/Alamofire)
+- [Alamofire 5.0+](https://github.com/Alamofire/Alamofire)
## Communication
@@ -41,7 +41,7 @@ Controls the visibility of the network activity indicator on iOS using Alamofire
[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
-pod 'AlamofireNetworkActivityIndicator', '~> 2.4'
+pod 'AlamofireNetworkActivityIndicator', '~> 3.0'
```
### Carthage
@@ -49,13 +49,13 @@ pod 'AlamofireNetworkActivityIndicator', '~> 2.4'
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
-github "Alamofire/AlamofireNetworkActivityIndicator" ~> 2.4.0
+github "Alamofire/AlamofireNetworkActivityIndicator" ~> 3.0
```
-### Swift Package Manager (required Xcode 11)
+### Swift Package Manager (requires Xcode 11)
1. Select File > Swift Packages > Add Package Dependency. Enter `https://github.com/Alamofire/AlamofireNetworkActivityIndicator` in the "Choose Package Repository" dialog.
-2. In the next page, specify the version resolving rule as "Up to Next Major" with "3.0.0-beta.4" as its earliest version.
+2. In the next page, specify the version resolving rule as "Up to Next Major" with "3.0.0" as its earliest version.
3. After Xcode checking out the source and resolving the version, you can choose the "AlamofireNetworkActivityIndicator" library and add it to your app target.
### Manually
diff --git a/Source/NetworkActivityIndicatorManager.swift b/Source/NetworkActivityIndicatorManager.swift
index 5dc4b70..99d3279 100644
--- a/Source/NetworkActivityIndicatorManager.swift
+++ b/Source/NetworkActivityIndicatorManager.swift
@@ -52,11 +52,11 @@ public class NetworkActivityIndicatorManager {
/// A boolean value indicating whether the manager is enabled. Defaults to `false`.
public var isEnabled: Bool {
get {
- lock.lock() ; defer { lock.unlock() }
+ lock.lock(); defer { lock.unlock() }
return enabled
}
set {
- lock.lock() ; defer { lock.unlock() }
+ lock.lock(); defer { lock.unlock() }
enabled = newValue
}
}
@@ -132,7 +132,7 @@ public class NetworkActivityIndicatorManager {
///
/// - Parameter requestID: The request identifier.
public func requestDidStart(requestID: String) {
- lock.lock() ; defer { lock.unlock() }
+ lock.lock(); defer { lock.unlock() }
requestIDs.insert(requestID)
updateActivityIndicatorStateForNetworkActivityChange()
@@ -144,7 +144,7 @@ public class NetworkActivityIndicatorManager {
///
/// - Parameter requestID: The request identifier.
public func requestDidStop(requestID: String) {
- lock.lock() ; defer { lock.unlock() }
+ lock.lock(); defer { lock.unlock() }
requestIDs.remove(requestID)
updateActivityIndicatorStateForNetworkActivityChange()
@@ -173,26 +173,20 @@ public class NetworkActivityIndicatorManager {
private func registerForNotifications() {
let notificationCenter = NotificationCenter.default
- notificationCenter.addObserver(
- self,
- selector: #selector(NetworkActivityIndicatorManager.networkRequestDidStart),
- name: Request.didResumeTaskNotification,
- object: nil
- )
-
- notificationCenter.addObserver(
- self,
- selector: #selector(NetworkActivityIndicatorManager.networkRequestDidStop),
- name: Request.didSuspendTaskNotification,
- object: nil
- )
-
- notificationCenter.addObserver(
- self,
- selector: #selector(NetworkActivityIndicatorManager.networkRequestDidStop),
- name: Request.didCompleteTaskNotification,
- object: nil
- )
+ notificationCenter.addObserver(self,
+ selector: #selector(NetworkActivityIndicatorManager.networkRequestDidStart),
+ name: Request.didResumeTaskNotification,
+ object: nil)
+
+ notificationCenter.addObserver(self,
+ selector: #selector(NetworkActivityIndicatorManager.networkRequestDidStop),
+ name: Request.didSuspendTaskNotification,
+ object: nil)
+
+ notificationCenter.addObserver(self,
+ selector: #selector(NetworkActivityIndicatorManager.networkRequestDidStop),
+ name: Request.didCompleteTaskNotification,
+ object: nil)
}
private func unregisterForNotifications() {
@@ -214,13 +208,11 @@ public class NetworkActivityIndicatorManager {
// MARK: - Private - Timers
private func scheduleStartDelayTimer() {
- let timer = Timer(
- timeInterval: startDelay,
- target: self,
- selector: #selector(NetworkActivityIndicatorManager.startDelayTimerFired),
- userInfo: nil,
- repeats: false
- )
+ let timer = Timer(timeInterval: startDelay,
+ target: self,
+ selector: #selector(NetworkActivityIndicatorManager.startDelayTimerFired),
+ userInfo: nil,
+ repeats: false)
DispatchQueue.main.async {
RunLoop.main.add(timer, forMode: .common)
@@ -231,13 +223,11 @@ public class NetworkActivityIndicatorManager {
}
private func scheduleCompletionDelayTimer() {
- let timer = Timer(
- timeInterval: completionDelay,
- target: self,
- selector: #selector(NetworkActivityIndicatorManager.completionDelayTimerFired),
- userInfo: nil,
- repeats: false
- )
+ let timer = Timer(timeInterval: completionDelay,
+ target: self,
+ selector: #selector(NetworkActivityIndicatorManager.completionDelayTimerFired),
+ userInfo: nil,
+ repeats: false)
DispatchQueue.main.async {
RunLoop.main.add(timer, forMode: .common)
@@ -248,7 +238,7 @@ public class NetworkActivityIndicatorManager {
}
@objc private func startDelayTimerFired() {
- lock.lock() ; defer { lock.unlock() }
+ lock.lock(); defer { lock.unlock() }
if !requestIDs.isEmpty {
activityIndicatorState = .active
@@ -258,7 +248,7 @@ public class NetworkActivityIndicatorManager {
}
@objc private func completionDelayTimerFired() {
- lock.lock() ; defer { lock.unlock() }
+ lock.lock(); defer { lock.unlock() }
activityIndicatorState = .notActive
}
diff --git a/Tests/NetworkActivityIndicatorManagerTests.swift b/Tests/NetworkActivityIndicatorManagerTests.swift
index 2f96026..27a0f88 100644
--- a/Tests/NetworkActivityIndicatorManagerTests.swift
+++ b/Tests/NetworkActivityIndicatorManagerTests.swift
@@ -22,8 +22,8 @@
// THE SOFTWARE.
//
-import Alamofire
@testable import AlamofireNetworkActivityIndicator
+import Alamofire
import Foundation
import XCTest
@@ -254,18 +254,21 @@ class NetworkActivityIndicatorManagerTestCase: XCTestCase {
manager.startDelay = 0.0
manager.completionDelay = 0.0
- let expectation = self.expectation(description: "visibility should change twice")
+ let visibility = expectation(description: "visibility should change twice")
var visibilityStates: [Bool] = []
manager.networkActivityIndicatorVisibilityChanged = { isVisible in
visibilityStates.append(isVisible)
- if visibilityStates.count == 2 { expectation.fulfill() }
+ if visibilityStates.count == 2 { visibility.fulfill() }
}
+ let request = expectation(description: "request should complete")
+
// When
- let _ = AF.request("https://httpbin.org/delay/1")
- waitForExpectations(timeout: timeout, handler: nil)
+ AF.request("https://httpbin.org/delay/1").response { _ in request.fulfill() }
+
+ waitForExpectations(timeout: timeout)
// Then
XCTAssertEqual(visibilityStates.count, 2)
@@ -282,18 +285,21 @@ class NetworkActivityIndicatorManagerTestCase: XCTestCase {
manager.startDelay = 0.0
manager.completionDelay = 0.0
- let expectation = self.expectation(description: "visibility should change twice")
+ let visibility = expectation(description: "visibility should change twice")
var visibilityStates: [Bool] = []
manager.networkActivityIndicatorVisibilityChanged = { isVisible in
visibilityStates.append(isVisible)
- if visibilityStates.count == 2 { expectation.fulfill() }
+ if visibilityStates.count == 2 { visibility.fulfill() }
}
+ let request = expectation(description: "request should complete")
+
// When
- let _ = AF.request("https://httpbin.org/status/404")
- waitForExpectations(timeout: timeout, handler: nil)
+ AF.request("https://httpbin.org/status/404").response { _ in request.fulfill() }
+
+ waitForExpectations(timeout: timeout)
// Then
XCTAssertEqual(visibilityStates.count, 2)
@@ -310,18 +316,21 @@ class NetworkActivityIndicatorManagerTestCase: XCTestCase {
manager.startDelay = 0.1
manager.completionDelay = 0.5
- let expectation = self.expectation(description: "visibility should change twice")
+ let visibility = expectation(description: "visibility should change twice")
var visibilityStates: [Bool] = []
manager.networkActivityIndicatorVisibilityChanged = { isVisible in
visibilityStates.append(isVisible)
- if visibilityStates.count == 2 { expectation.fulfill() }
+ if visibilityStates.count == 2 { visibility.fulfill() }
}
+ let request = expectation(description: "request should complete")
+
// When
- let _ = AF.request("https://httpbin.org/delay/1")
- waitForExpectations(timeout: timeout, handler: nil)
+ AF.request("https://httpbin.org/delay/1").response { _ in request.fulfill() }
+
+ waitForExpectations(timeout: timeout)
// Then
XCTAssertEqual(visibilityStates.count, 2)
@@ -338,21 +347,24 @@ class NetworkActivityIndicatorManagerTestCase: XCTestCase {
manager.startDelay = 0.1
manager.completionDelay = 0.5
- let expectation = self.expectation(description: "visibility should change twice")
+ let visibility = expectation(description: "visibility should change twice")
var visibilityStates: [Bool] = []
manager.networkActivityIndicatorVisibilityChanged = { isVisible in
visibilityStates.append(isVisible)
- if visibilityStates.count == 2 { expectation.fulfill() }
+ if visibilityStates.count == 2 { visibility.fulfill() }
}
+ let request = expectation(description: "request should complete")
+ request.expectedFulfillmentCount = 3
+
// When
- let _ = AF.request("https://httpbin.org/delay/1")
- let _ = AF.request("https://httpbin.org/delay/1")
- let _ = AF.request("https://httpbin.org/delay/1")
+ AF.request("https://httpbin.org/delay/1").response { _ in request.fulfill() }
+ AF.request("https://httpbin.org/delay/1").response { _ in request.fulfill() }
+ AF.request("https://httpbin.org/delay/1").response { _ in request.fulfill() }
- waitForExpectations(timeout: timeout, handler: nil)
+ waitForExpectations(timeout: timeout)
// Then
XCTAssertEqual(visibilityStates.count, 2)
diff --git a/docs/Classes.html b/docs/Classes.html
index eccbfde..802f9cc 100644
--- a/docs/Classes.html
+++ b/docs/Classes.html
@@ -23,7 +23,7 @@
- (90% documented)
+ (100% documented)