Skip to content

Commit

Permalink
Updated code for Xcode 8 (with swift 2.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrollin committed Sep 28, 2016
1 parent 5ed9f65 commit 4ed0572
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 117 deletions.
38 changes: 34 additions & 4 deletions Drivecast.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@
49FC9A3A1BCFB5D4006FA40E /* Frameworks */,
49FC9A3B1BCFB5D4006FA40E /* Resources */,
1AFF0B5AC2C23E4C1DA8F1CA /* [CP] Copy Pods Resources */,
C45B4DC3AD006A34F801DE4A /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -542,7 +543,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = Safecast;
TargetAttributes = {
49FC9A1D1BCFB5D4006FA40E = {
Expand Down Expand Up @@ -643,7 +644,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
381F4085A8E9779D7C59FA26 /* [CP] Embed Pods Frameworks */ = {
Expand Down Expand Up @@ -717,7 +718,22 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
C45B4DC3AD006A34F801DE4A /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DrivecastUITests/Pods-DrivecastUITests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CE97D34554E16B1E16F8B783 /* [CP] Embed Pods Frameworks */ = {
Expand Down Expand Up @@ -747,7 +763,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -890,8 +906,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 Down Expand Up @@ -919,6 +937,7 @@
OTHER_SWIFT_FLAGS = "-DDEBUG";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = "Production Debug";
};
Expand All @@ -935,8 +954,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 Distribution";
Expand All @@ -957,6 +978,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 2.3;
VALIDATE_PRODUCT = YES;
};
name = "Production Release";
Expand Down Expand Up @@ -1072,8 +1095,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 Down Expand Up @@ -1101,6 +1126,7 @@
OTHER_SWIFT_FLAGS = "-DSTAGING -DDEBUG";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = "Staging Debug";
};
Expand Down Expand Up @@ -1167,8 +1193,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 Distribution";
Expand All @@ -1190,6 +1218,8 @@
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_SWIFT_FLAGS = "-DSTAGING";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 2.3;
VALIDATE_PRODUCT = YES;
};
name = "Staging Release";
Expand Down
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
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
95 changes: 52 additions & 43 deletions Drivecast/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen

import UIKit
#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit.UIColor
typealias Color = UIColor
#elseif os(OSX)
import AppKit.NSColor
typealias Color = NSColor
#endif

extension UIColor {
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0
Expand All @@ -13,52 +19,55 @@ extension UIColor {
}
}

extension UIColor {
enum Name {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#e74c3c"></span>
/// Alpha: 100% <br/> (0xe74c3cff)
case Alert
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#e98b39"></span>
/// Alpha: 100% <br/> (0xe98b39ff)
case Awaiting
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#f8fcff"></span>
/// Alpha: 100% <br/> (0xf8fcffff)
case Background
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#aaaaaa"></span>
/// Alpha: 100% <br/> (0xaaaaaaff)
case LightText
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#3498db"></span>
/// Alpha: 100% <br/> (0x3498dbff)
case Main
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#f39c12"></span>
/// Alpha: 100% <br/> (0xf39c12ff)
case Notice
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#dddddd"></span>
/// Alpha: 100% <br/> (0xddddddff)
case Separator
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#333333"></span>
/// Alpha: 100% <br/> (0x333333ff)
case Text
// swiftlint:disable file_length
// swiftlint:disable type_body_length
enum ColorName {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#e74c3c"></span>
/// Alpha: 100% <br/> (0xe74c3cff)
case Alert
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#e98b39"></span>
/// Alpha: 100% <br/> (0xe98b39ff)
case Awaiting
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#f8fcff"></span>
/// Alpha: 100% <br/> (0xf8fcffff)
case Background
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#aaaaaa"></span>
/// Alpha: 100% <br/> (0xaaaaaaff)
case LightText
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#3498db"></span>
/// Alpha: 100% <br/> (0x3498dbff)
case Main
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#f39c12"></span>
/// Alpha: 100% <br/> (0xf39c12ff)
case Notice
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#dddddd"></span>
/// Alpha: 100% <br/> (0xddddddff)
case Separator
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#333333"></span>
/// Alpha: 100% <br/> (0x333333ff)
case Text

var rgbaValue: UInt32! {
switch self {
case .Alert: return 0xe74c3cff
case .Awaiting: return 0xe98b39ff
case .Background: return 0xf8fcffff
case .LightText: return 0xaaaaaaff
case .Main: return 0x3498dbff
case .Notice: return 0xf39c12ff
case .Separator: return 0xddddddff
case .Text: return 0x333333ff
}
var rgbaValue: UInt32 {
switch self {
case .Alert: return 0xe74c3cff
case .Awaiting: return 0xe98b39ff
case .Background: return 0xf8fcffff
case .LightText: return 0xaaaaaaff
case .Main: return 0x3498dbff
case .Notice: return 0xf39c12ff
case .Separator: return 0xddddddff
case .Text: return 0x333333ff
}
}

var color: UIColor {
return UIColor(named: self)
}
var color: Color {
return Color(named: self)
}
}
// swiftlint:enable type_body_length

convenience init(named name: Name) {
extension Color {
convenience init(named name: ColorName) {
self.init(rgbaValue: name.rgbaValue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Drivecast/Extensions/UIControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ extension UIControl {

// Simplifies a control enable status update with RAC
public var rac_enabled: MutableProperty<Bool> {
return lazyMutableProperty(self, key: &AssociationKey.hidden, setter: { self.enabled = $0 }, getter: { self.enabled })
return lazyMutableProperty(self, key: &AssociationKey.enabled, setter: { self.enabled = $0 }, getter: { self.enabled })
}
}
51 changes: 30 additions & 21 deletions Drivecast/Extensions/UIImage.swift
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen

import UIKit
#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit.UIImage
typealias Image = UIImage
#elseif os(OSX)
import AppKit.NSImage
typealias Image = NSImage
#endif

extension UIImage {
enum Asset: String {
case Dot = "Dot"
case Header = "Header"
case Back = "Back"
case Center = "Center"
case Console = "Console"
case Github = "Github"
case Home = "Home"
case More = "More"
case Record = "Record"
case Resize = "Resize"
case Upload = "Upload"
case SafecastBoxed = "SafecastBoxed"
case SafecastLettersBig = "SafecastLettersBig"
case SafecastLettersSmall = "SafecastLettersSmall"
case Separator = "Separator"
// swiftlint:disable file_length
// swiftlint:disable type_body_length
enum Asset: String {
case Dot = "Dot"
case Header = "Header"
case Back = "Back"
case Center = "Center"
case Console = "Console"
case Github = "Github"
case Home = "Home"
case More = "More"
case Record = "Record"
case Resize = "Resize"
case Upload = "Upload"
case SafecastBoxed = "SafecastBoxed"
case SafecastLettersBig = "SafecastLettersBig"
case SafecastLettersSmall = "SafecastLettersSmall"
case Separator = "Separator"

var image: UIImage {
return UIImage(asset: self)
}
var image: Image {
return Image(asset: self)
}
}
// swiftlint:enable type_body_length

extension Image {
convenience init!(asset: Asset) {
self.init(named: asset.rawValue)
}
Expand Down
33 changes: 29 additions & 4 deletions Drivecast/Extensions/UIStoryboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ extension StoryboardSceneType {
}

static func initialViewController() -> UIViewController {
return storyboard().instantiateInitialViewController()!
guard let vc = storyboard().instantiateInitialViewController() else {
fatalError("Failed to instantiate initialViewController for \(self.storyboardName)")
}
return vc
}
}

Expand All @@ -34,23 +37,45 @@ extension UIViewController {
}
}

// swiftlint:disable file_length
// swiftlint:disable type_body_length

struct StoryboardScene {
enum Main: String, StoryboardSceneType {
static let storyboardName = "Main"

static func initialViewController() -> UINavigationController {
guard let vc = storyboard().instantiateInitialViewController() as? UINavigationController else {
fatalError("Failed to instantiate initialViewController for \(self.storyboardName)")
}
return vc
}

case AboutScene = "About"
static func instantiateAbout() -> UINavigationController {
return StoryboardScene.Main.AboutScene.viewController() as! UINavigationController
guard let vc = StoryboardScene.Main.AboutScene.viewController() as? UINavigationController
else {
fatalError("ViewController 'About' is not of the expected class UINavigationController.")
}
return vc
}

case MenuScene = "Menu"
static func instantiateMenu() -> UITabBarController {
return StoryboardScene.Main.MenuScene.viewController() as! UITabBarController
guard let vc = StoryboardScene.Main.MenuScene.viewController() as? UITabBarController
else {
fatalError("ViewController 'Menu' is not of the expected class UITabBarController.")
}
return vc
}

case RecordScene = "Record"
static func instantiateRecord() -> UINavigationController {
return StoryboardScene.Main.RecordScene.viewController() as! UINavigationController
guard let vc = StoryboardScene.Main.RecordScene.viewController() as? UINavigationController
else {
fatalError("ViewController 'Record' is not of the expected class UINavigationController.")
}
return vc
}
}
}
Expand Down
Loading

0 comments on commit 4ed0572

Please sign in to comment.