Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,16 @@
attributes = {
CLASSPREFIX = "";
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "";
TargetAttributes = {
1427F6611BFC9E9A007B9423 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
146D72AB1AB782920058798C = {
CreatedOnToolsVersion = 6.2;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -259,6 +261,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.demo.Demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -273,6 +276,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.demo.Demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -289,8 +293,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -299,6 +305,7 @@
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -331,15 +338,18 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand All @@ -349,6 +359,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -367,6 +378,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.sample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -379,6 +391,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.sample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -392,6 +405,7 @@
1427F66D1BFC9E9A007B9423 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
146D728E1AB782920058798C /* Build configuration list for PBXProject "Demo" */ = {
isa = XCConfigurationList;
Expand Down
2 changes: 1 addition & 1 deletion Demo.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
21 changes: 12 additions & 9 deletions Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = UINavigationController(rootViewController: Controller())
self.window!.makeKeyAndVisible()
return true
Expand All @@ -25,20 +25,22 @@ class Controller: UITableViewController {

self.title = "Simulated activities"
self.tableView.rowHeight = 60
self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.dataSource.count
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath as IndexPath)
let option = self.dataSource[indexPath.row]
cell.textLabel?.text = option.activated ? "Stop activity" : "Run activity"
cell.textLabel?.textColor = option.activated ? UIColor.redColor() : UIColor.blueColor()
cell.textLabel?.textColor = option.activated ? UIColor.red : UIColor.blue

let indicator = UIActivityIndicatorView(activityIndicatorStyle: .Gray)
let indicator = UIActivityIndicatorView(activityIndicatorStyle: .gray)
indicator.hidesWhenStopped = true
cell.accessoryView = indicator

Expand All @@ -51,7 +53,8 @@ class Controller: UITableViewController {
return cell
}

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

var option = self.dataSource[indexPath.row]
option.activated = !option.activated
self.dataSource[indexPath.row] = option
Expand Down
10 changes: 5 additions & 5 deletions Source/NetworkActivityIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import UIKit
#endif

public class NetworkActivityIndicator: NSObject {
open class NetworkActivityIndicator: NSObject {

/**
The shared instance.
*/
public static let sharedIndicator = NetworkActivityIndicator()
open static let sharedIndicator = NetworkActivityIndicator()

/**
The number of activities in progress.
Expand All @@ -19,7 +19,7 @@ public class NetworkActivityIndicator: NSObject {

Specify true if the app should show network activity and false if it should not. The default value is false. A spinning indicator in the status bar shows network activity. Multiple calls to visible cause an internal counter to take care of persisting the number of times this method has being called.
*/
public var visible: Bool = false {
open var visible: Bool = false {
didSet {
if visible {
self.activitiesCount += 1
Expand All @@ -32,8 +32,8 @@ public class NetworkActivityIndicator: NSObject {
}

#if os(iOS)
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(0.5 * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), {
UIApplication.sharedApplication().networkActivityIndicatorVisible = (self.activitiesCount > 0)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(0.5 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: {
UIApplication.shared.isNetworkActivityIndicatorVisible = (self.activitiesCount > 0)
})
#endif
}
Expand Down