Skip to content

Commit

Permalink
Update for Swift 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleymills committed Sep 14, 2016
1 parent 2264482 commit a17b288
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Reachability.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = uk.co.joylordsystems.ReachabilitySample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -956,6 +957,7 @@
PRODUCT_BUNDLE_IDENTIFIER = uk.co.joylordsystems.ReachabilitySample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion ReachabilitySample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
fileprivate func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
8 changes: 4 additions & 4 deletions ReachabilitySample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ class ViewController: UIViewController {
super.viewDidLoad()

// Start reachability without a hostname intially
setupReachability(hostName: nil, useClosures: true)
setupReachability(nil, useClosures: true)
startNotifier()

// After 5 seconds, stop and re-start reachability, this time using a hostname
let dispatchTime = DispatchTime.now() + DispatchTimeInterval.seconds(5)
DispatchQueue.main.asyncAfter(deadline: dispatchTime) {
self.stopNotifier()
self.setupReachability(hostName: "google.com", useClosures: true)
self.setupReachability("google.com", useClosures: true)
self.startNotifier()

let dispatchTime = DispatchTime.now() + DispatchTimeInterval.seconds(5)
DispatchQueue.main.asyncAfter(deadline: dispatchTime) {
self.stopNotifier()
self.setupReachability(hostName: "invalidhost", useClosures: true)
self.setupReachability("invalidhost", useClosures: true)
self.startNotifier() }

}
}

func setupReachability(hostName: String?, useClosures: Bool) {
func setupReachability(_ hostName: String?, useClosures: Bool) {
hostNameLabel.text = hostName != nil ? hostName : "No host name"

print("--- set up with host name: \(hostNameLabel.text!)")
Expand Down
2 changes: 1 addition & 1 deletion ReachabilitySwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ReachabilitySwift'
s.version = '2.3.3'
s.version = '3'
s.homepage = 'https://github.com/ashleymills/Reachability.swift'
s.authors = {
'Ashley Mills' => '[email protected]'
Expand Down

0 comments on commit a17b288

Please sign in to comment.