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

@@ -14,10 +14,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate
var window: UIWindow?
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?.rootViewController = self.mainViewController
self.window?.makeKeyAndVisible()
@@ -35,7 +34,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate
self.mainViewController.viewDidDisappear(false)
}
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask
func application(_ application: UIApplication,
supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask
{
var mask: UIInterfaceOrientationMask = .portrait

View File

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

View File

@@ -213,7 +213,7 @@ class SwitchesViewController: UIViewController,
for i in ActionCell.count ..< collectionView.numberOfItems(inSection: indexPath.section) {
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: {
cell.toggled = (tappedActionCell == .allOn)

View File

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

View File

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

View File

@@ -46,7 +46,7 @@ extension 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

View File

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