summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrettyWhite <geekman3454@protonmail.com>2017-05-22 11:51:33 -0400
committerBrettyWhite <geekman3454@protonmail.com>2017-05-22 11:51:33 -0400
commitd2d0417d0e3ecead75a6ace67038fb5c35231ea2 (patch)
treefc8f8ede126e3f45a0a7d0b08478bdb42718d697
parent4826b8cdf89662b5e087d9d5083ca164218b4a29 (diff)
downloadsdl_ios-feature/Hello_SDL_Swift.tar.gz
changing to fit swift3 design patternfeature/Hello_SDL_Swift
-rw-r--r--SmartDeviceLink-ExampleSwift/ConnectionIAPTableViewController.swift14
-rw-r--r--SmartDeviceLink-ExampleSwift/ConnectionTCPTableViewController.swift14
-rw-r--r--SmartDeviceLink-ExampleSwift/ProxyManager.swift16
3 files changed, 22 insertions, 22 deletions
diff --git a/SmartDeviceLink-ExampleSwift/ConnectionIAPTableViewController.swift b/SmartDeviceLink-ExampleSwift/ConnectionIAPTableViewController.swift
index b60a5bf9c..4034ae591 100644
--- a/SmartDeviceLink-ExampleSwift/ConnectionIAPTableViewController.swift
+++ b/SmartDeviceLink-ExampleSwift/ConnectionIAPTableViewController.swift
@@ -13,7 +13,7 @@ class ConnectionIAPTableViewController: UITableViewController, ProxyManagerDeleg
@IBOutlet weak var table: UITableView!
@IBOutlet weak var connectButton: UIButton!
- var state: ProxyState = ProxyState.Stopped
+ var state: ProxyState = ProxyState.stopped
override func viewDidLoad() {
super.viewDidLoad()
@@ -41,11 +41,11 @@ class ConnectionIAPTableViewController: UITableViewController, ProxyManagerDeleg
// Initialize (or reset) the SDL manager
switch state {
- case ProxyState.Stopped:
+ case ProxyState.stopped:
ProxyManager.sharedManager.startIAP()
- case ProxyState.Searching:
+ case ProxyState.searching:
ProxyManager.sharedManager.reset()
- case ProxyState.Connected:
+ case ProxyState.connected:
ProxyManager.sharedManager.reset()
}
}
@@ -57,13 +57,13 @@ class ConnectionIAPTableViewController: UITableViewController, ProxyManagerDeleg
var newTitle: String? = nil
switch newState {
- case .Stopped:
+ case .stopped:
newColor = UIColor.red
newTitle = "Connect"
- case .Searching:
+ case .searching:
newColor = UIColor.blue
newTitle = "Stop Searching"
- case .Connected:
+ case .connected:
newColor = UIColor.green
newTitle = "Disconnect"
}
diff --git a/SmartDeviceLink-ExampleSwift/ConnectionTCPTableViewController.swift b/SmartDeviceLink-ExampleSwift/ConnectionTCPTableViewController.swift
index c4928ac0f..3d2e225ba 100644
--- a/SmartDeviceLink-ExampleSwift/ConnectionTCPTableViewController.swift
+++ b/SmartDeviceLink-ExampleSwift/ConnectionTCPTableViewController.swift
@@ -16,7 +16,7 @@ class ConnectionTCPTableViewController: UITableViewController, UINavigationContr
@IBOutlet weak var connectButton: UIButton!
@IBOutlet weak var table: UITableView!
- var state: ProxyState = ProxyState.Stopped
+ var state: ProxyState = ProxyState.stopped
override func viewDidLoad() {
super.viewDidLoad()
@@ -54,11 +54,11 @@ class ConnectionTCPTableViewController: UITableViewController, UINavigationContr
// Initialize (or reset) the SDL manager
switch state {
- case ProxyState.Stopped:
+ case ProxyState.stopped:
ProxyManager.sharedManager.startTCP()
- case ProxyState.Searching:
+ case ProxyState.searching:
ProxyManager.sharedManager.reset()
- case ProxyState.Connected:
+ case ProxyState.connected:
ProxyManager.sharedManager.reset()
}
}else{
@@ -76,13 +76,13 @@ class ConnectionTCPTableViewController: UITableViewController, UINavigationContr
var newTitle: String? = nil
switch newState {
- case .Stopped:
+ case .stopped:
newColor = UIColor.red
newTitle = "Connect"
- case .Searching:
+ case .searching:
newColor = UIColor.blue
newTitle = "Stop Searching"
- case .Connected:
+ case .connected:
newColor = UIColor.green
newTitle = "Disconnect"
}
diff --git a/SmartDeviceLink-ExampleSwift/ProxyManager.swift b/SmartDeviceLink-ExampleSwift/ProxyManager.swift
index 7eeced89e..17fdb9a4d 100644
--- a/SmartDeviceLink-ExampleSwift/ProxyManager.swift
+++ b/SmartDeviceLink-ExampleSwift/ProxyManager.swift
@@ -8,9 +8,9 @@ import UIKit
import SmartDeviceLink
enum ProxyState {
- case Stopped
- case Searching
- case Connected
+ case stopped
+ case searching
+ case connected
}
weak var delegate:ProxyManagerDelegate?
@@ -33,13 +33,13 @@ class ProxyManager: NSObject {
// MARK: - SDL Setup
func startIAP() {
- delegate?.didChangeProxyState(ProxyState.Searching)
+ delegate?.didChangeProxyState(ProxyState.searching)
let lifecycleConfiguration = setLifecycleConfigurationPropertiesOnConfiguration(SDLLifecycleConfiguration.defaultConfiguration(withAppName: AppConstants.sdlAppName, appId: AppConstants.sdlAppID))
startSDLManager(lifecycleConfiguration)
}
func startTCP() {
- delegate?.didChangeProxyState(ProxyState.Searching)
+ delegate?.didChangeProxyState(ProxyState.searching)
let defaultIP = UserDefaults.standard.string(forKey: "ipAddress")!
let defaultPort = UInt16(UserDefaults.standard.string(forKey: "port")!)!
let lifecycleConfiguration = setLifecycleConfigurationPropertiesOnConfiguration(SDLLifecycleConfiguration.debugConfiguration(withAppName: AppConstants.sdlAppName, appId: AppConstants.sdlAppID, ipAddress: defaultIP, port: defaultPort))
@@ -54,7 +54,7 @@ class ProxyManager: NSObject {
// Start watching for a connection with a SDL Core
self.sdlManager?.start(readyHandler: { [unowned self] (success, error) in
if success {
- delegate?.didChangeProxyState(ProxyState.Connected)
+ delegate?.didChangeProxyState(ProxyState.connected)
print("SDL start file manager storage: \(self.sdlManager!.fileManager.bytesAvailable / 1024 / 1024) mb")
}
if let error = error {
@@ -80,14 +80,14 @@ class ProxyManager: NSObject {
func reset() {
sdlManager?.stop()
- delegate?.didChangeProxyState(ProxyState.Stopped)
+ delegate?.didChangeProxyState(ProxyState.stopped)
}
}
// MARK: SDLManagerDelegate
extension ProxyManager: SDLManagerDelegate {
func managerDidDisconnect() {
- delegate?.didChangeProxyState(ProxyState.Stopped)
+ delegate?.didChangeProxyState(ProxyState.stopped)
}
func hmiLevel(_ oldLevel: SDLHMILevel, didChangeTo newLevel: SDLHMILevel) {