Convert to Swift 4.0 syntax

This commit is contained in:
Charles Magahern
2019-09-24 22:17:16 -07:00
parent 12f9b4eff0
commit 51d0faf556
8 changed files with 38 additions and 13 deletions

View File

@@ -248,7 +248,7 @@
0C3CAEA31C3350C800B856AD = { 0C3CAEA31C3350C800B856AD = {
CreatedOnToolsVersion = 7.2; CreatedOnToolsVersion = 7.2;
DevelopmentTeam = F7W5R35V7L; DevelopmentTeam = F7W5R35V7L;
LastSwiftMigration = 0810; LastSwiftMigration = 1010;
}; };
}; };
}; };
@@ -428,7 +428,7 @@
PRODUCT_NAME = XION; PRODUCT_NAME = XION;
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "XIONControlPanel/SupportingFiles/XIONControlPanel-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "XIONControlPanel/SupportingFiles/XIONControlPanel-Bridging-Header.h";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Debug; name = Debug;
@@ -447,7 +447,7 @@
PRODUCT_NAME = XION; PRODUCT_NAME = XION;
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "XIONControlPanel/SupportingFiles/XIONControlPanel-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "XIONControlPanel/SupportingFiles/XIONControlPanel-Bridging-Header.h";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Release; name = Release;

View File

@@ -14,10 +14,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate
var window: UIWindow? var window: UIWindow?
var mainViewController: MainViewController = MainViewController() var mainViewController: MainViewController = MainViewController()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{ {
application.isStatusBarHidden = true
self.window = UIWindow(frame: UIScreen.main.bounds) self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = self.mainViewController self.window?.rootViewController = self.mainViewController
self.window?.makeKeyAndVisible() self.window?.makeKeyAndVisible()
@@ -35,7 +34,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate
self.mainViewController.viewDidDisappear(false) self.mainViewController.viewDidDisappear(false)
} }
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask func application(_ application: UIApplication,
supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask
{ {
var mask: UIInterfaceOrientationMask = .portrait var mask: UIInterfaceOrientationMask = .portrait

View File

@@ -37,11 +37,11 @@ class MainViewController: UIViewController, SwitchesViewControllerDelegate
self.view.backgroundColor = UIColor.black self.view.backgroundColor = UIColor.black
self.addChildViewController(_visualizationController) self.addChild(_visualizationController)
self.view.addSubview(_visualizationController.view) self.view.addSubview(_visualizationController.view)
_switchesController.delegate = self _switchesController.delegate = self
self.addChildViewController(_switchesController) self.addChild(_switchesController)
self.view.addSubview(_switchesController.view) self.view.addSubview(_switchesController.view)
self.view.addSubview(_headerView) self.view.addSubview(_headerView)

View File

@@ -213,7 +213,7 @@ class SwitchesViewController: UIViewController,
for i in ActionCell.count ..< collectionView.numberOfItems(inSection: indexPath.section) { for i in ActionCell.count ..< collectionView.numberOfItems(inSection: indexPath.section) {
if let cell = collectionView.cellForItem(at: IndexPath(item: i, section: indexPath.section)) as? WemoDeviceCellView { if let cell = collectionView.cellForItem(at: IndexPath(item: i, section: indexPath.section)) as? WemoDeviceCellView {
let animOptions = UIViewAnimationOptions([.allowUserInteraction]) let animOptions = UIView.AnimationOptions([.allowUserInteraction])
UIView.animate(withDuration: 0.3, delay: currentDelay, options: animOptions, animations: { UIView.animate(withDuration: 0.3, delay: currentDelay, options: animOptions, animations: {
cell.toggled = (tappedActionCell == .allOn) cell.toggled = (tappedActionCell == .allOn)

View File

@@ -179,7 +179,7 @@ class VisualizationViewController: UIViewController
internal func _setupModel() internal func _setupModel()
{ {
_cubletsNode.enumerateChildNodes { $0.0.removeFromParentNode() } _cubletsNode.enumerateChildNodes { (child, _) in child.removeFromParentNode() }
_cublets.removeAll() _cublets.removeAll()
let sz = Float(VisualizationViewController.cubletsSize) let sz = Float(VisualizationViewController.cubletsSize)

View File

@@ -1,5 +1,15 @@
{ {
"images" : [ "images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{ {
"size" : "29x29", "size" : "29x29",
"idiom" : "iphone", "idiom" : "iphone",
@@ -36,6 +46,16 @@
"filename" : "Icon-60@3x.png", "filename" : "Icon-60@3x.png",
"scale" : "3x" "scale" : "3x"
}, },
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{ {
"size" : "29x29", "size" : "29x29",
"idiom" : "ipad", "idiom" : "ipad",
@@ -77,6 +97,11 @@
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-167@2x.png", "filename" : "Icon-167@2x.png",
"scale" : "2x" "scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
} }
], ],
"info" : { "info" : {

View File

@@ -46,7 +46,7 @@ extension NSError
class func xionError(_ code: XIONErrorCode, userInfo: [AnyHashable: Any]?) -> NSError class func xionError(_ code: XIONErrorCode, userInfo: [AnyHashable: Any]?) -> NSError
{ {
return NSError(domain: XIONErrorDomain, code: code.rawValue, userInfo: userInfo) return NSError(domain: XIONErrorDomain, code: code.rawValue, userInfo: userInfo as? [String : Any])
} }
var xionErrorCode: XIONErrorCode var xionErrorCode: XIONErrorCode

View File

@@ -46,7 +46,7 @@ open class WemoCellView: UICollectionViewCell
if (self.isHighlighted) { if (self.isHighlighted) {
_selectionOverlayView.backgroundColor = UIColor(white: 0.8, alpha: 1.0) _selectionOverlayView.backgroundColor = UIColor(white: 0.8, alpha: 1.0)
} else { } else {
let animOptions = UIViewAnimationOptions([.allowUserInteraction]) let animOptions = UIView.AnimationOptions([.allowUserInteraction])
UIView.animate(withDuration: 1.0, delay: 0.0, options: animOptions, animations: { UIView.animate(withDuration: 1.0, delay: 0.0, options: animOptions, animations: {
self._selectionOverlayView.backgroundColor = UIColor.clear self._selectionOverlayView.backgroundColor = UIColor.clear
}, completion: nil) }, completion: nil)