Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Swift 4.2 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 52 additions & 27 deletions Boa.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@
903EDF4E1CC562CA00AF813C /* Frameworks */,
903EDF4F1CC562CA00AF813C /* Resources */,
166E013E10EC432DD7C337E7 /* [CP] Embed Pods Frameworks */,
1F233A7FC545E68AB0ACF443 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -334,13 +333,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = com.locationlabs;
TargetAttributes = {
903EDF501CC562CA00AF813C = {
CreatedOnToolsVersion = 7.3;
DevelopmentTeam = EX6732J87R;
LastSwiftMigration = 0800;
LastSwiftMigration = 1010;
};
};
};
Expand Down Expand Up @@ -385,28 +383,26 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-BoaBase-Boa/Pods-BoaBase-Boa-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Cobra/Cobra.framework",
"${BUILT_PRODUCTS_DIR}/Gorgon/Gorgon.framework",
"${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework",
"${BUILT_PRODUCTS_DIR}/Swinject/Swinject.framework",
"${BUILT_PRODUCTS_DIR}/SwinjectPropertyLoader/SwinjectPropertyLoader.framework",
"${BUILT_PRODUCTS_DIR}/SwinjectStoryboard/SwinjectStoryboard.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cobra.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Gorgon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Swinject.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwinjectPropertyLoader.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwinjectStoryboard.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BoaBase-Boa/Pods-BoaBase-Boa-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
1F233A7FC545E68AB0ACF443 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BoaBase-Boa/Pods-BoaBase-Boa-resources.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-BoaBase-Boa/Pods-BoaBase-Boa-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
2B58033588649AB2785A590C /* [CP] Check Pods Manifest.lock */ = {
Expand All @@ -415,13 +411,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-BoaBase-Boa-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/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# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -498,13 +497,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -526,11 +535,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -543,13 +553,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -565,9 +585,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -577,12 +598,14 @@
baseConfigurationReference = EFFD31DE1512AC4D2396E94B /* Pods-BoaBase-Boa.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = EX6732J87R;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Boa/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.locationlabs.Boa;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0.1;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -591,12 +614,14 @@
baseConfigurationReference = 4E8D56AEC63192205F00F01D /* Pods-BoaBase-Boa.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = EX6732J87R;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Boa/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.locationlabs.Boa;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0.1;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Boa.xcodeproj/xcshareddata/xcschemes/Boa.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Boa/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow? = UIWindow()

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
logDebug(message: "Application starting...")

//
Expand Down
15 changes: 15 additions & 0 deletions Boa/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -29,6 +39,11 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
2 changes: 0 additions & 2 deletions Boa/ExpandingCellTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ class ExpandingCellTransition: NSObject, UIViewControllerAnimatedTransitioning,
// perform animation
backgroundViewController.view.isHidden = true
UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: [], animations: { () -> Void in
[self]
self.configureViewsToState(state: postTransition, width: width, height: height, targetFrame: targetFrame, foregroundView: foregroundViewController.view)
}, completion: {
(finished) in
[self]
self.topRegionSnapshot.removeFromSuperview()
self.bottomRegionSnapshot.removeFromSuperview()

Expand Down
4 changes: 2 additions & 2 deletions Boa/Extensions/UIColor+Boa.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public extension UIColor {

if rgb.hasPrefix("#") {
let index = rgb.index(rgb.startIndex, offsetBy:1)
let hex = rgb.substring(from: index)
let hex = String(rgb[index...])
let scanner = Scanner(string: hex)
var hexValue: CUnsignedLongLong = 0
if scanner.scanHexInt64(&hexValue) {
if hex.characters.count == 6 {
if hex.count == 6 {
red = CGFloat((hexValue & 0xFF0000) >> 16)
green = CGFloat((hexValue & 0x00FF00) >> 8)
blue = CGFloat(hexValue & 0x0000FF)
Expand Down
16 changes: 8 additions & 8 deletions Boa/Modules/Weather/WeatherStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ struct WeatherStyle: WeatherStyleType, BaseStyleType {
navigationBar.isTranslucent = false
navigationBar.barStyle = .black
navigationBar.titleTextAttributes = [
NSForegroundColorAttributeName: UIColor.white,
NSFontAttributeName: UIFont(name: "AvenirNext-Regular", size: 20.0)!
NSAttributedString.Key.foregroundColor: UIColor.white,
NSAttributedString.Key.font: UIFont(name: "AvenirNext-Regular", size: 20.0)!
]
}

func styleAddBarButtonItem(_ barButtonItem: UIBarButtonItem) {
barButtonItem.tintColor = .white
barButtonItem.setTitleTextAttributes([
NSFontAttributeName: UIFont(name: "AvenirNext-Regular", size: 17.0)!
], for: UIControlState())
NSAttributedString.Key.font: UIFont(name: "AvenirNext-Regular", size: 17.0)!
], for: UIControl.State())
}

func styleFooterView(_ view: WeatherTableFooterView, isCelcius: Bool) {
let title = NSMutableAttributedString(string: "f / c", attributes: [NSForegroundColorAttributeName: UIColor.lightGray])
let title = NSMutableAttributedString(string: "f / c", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray])

var range: NSRange
if isCelcius {
Expand All @@ -58,10 +58,10 @@ struct WeatherStyle: WeatherStyleType, BaseStyleType {
range = NSRange(location: 0, length: 1)
}

title.addAttribute(NSForegroundColorAttributeName, value: UIColor.white, range: range)
title.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.white, range: range)

view.weatherFormat.setAttributedTitle(title, for: UIControlState())
view.weatherFormat.setAttributedTitle(title, for: UIControl.State())

view.addButton.setImage(UIImage(named:"PlusIcon")?.withTint(color: .white), for: UIControlState())
view.addButton.setImage(UIImage(named:"PlusIcon")?.withTint(color: .white), for: UIControl.State())
}
}
23 changes: 14 additions & 9 deletions Boa/Modules/WeatherDetail/WeatherPageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ final class WeatherPageViewController: UIViewController {
@IBOutlet weak var pageControl: UIPageControl!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
UIApplication.shared.statusBarStyle = .lightContent
}
@IBAction func didPressListButton(_ sender: AnyObject) {
presenter.requestListView()
Expand All @@ -41,10 +40,14 @@ final class WeatherPageViewController: UIViewController {
direction: .forward, animated: true, completion: nil)


addChildViewController(pageViewController)
addChild(pageViewController)
pageViewController.view.frame = CGRect(x: 0,y: 0,width: containerView.frame.size.width, height: containerView.frame.size.height)
containerView.addSubview(pageViewController.view)
pageViewController.didMove(toParentViewController: self)
pageViewController.didMove(toParent: self)
}

override var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}
}

Expand Down Expand Up @@ -105,12 +108,14 @@ extension WeatherPageViewController : UIPageViewControllerDelegate, UIPageViewCo
extension WeatherPageViewController {
fileprivate func initViewControllers() {
let weatherDetailStoryboard = UIStoryboard(name: "WeatherDetail", bundle: nil)

orderedWeatherDetailViewControllers = weatherReports.map {
let weatherDetailVC = weatherDetailStoryboard.instantiateViewController(withIdentifier: "WeatherDetail") as! WeatherDetailViewController
weatherDetailVC.weatherReport = $0
weatherDetailVC.styler = styler
return weatherDetailVC

if let reports = weatherReports {
orderedWeatherDetailViewControllers = reports.map {
let weatherDetailVC = weatherDetailStoryboard.instantiateViewController(withIdentifier: "WeatherDetail") as! WeatherDetailViewController
weatherDetailVC.weatherReport = $0
weatherDetailVC.styler = styler
return weatherDetailVC
}
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ DEPENDENCIES:
- SwinjectPropertyLoader (= 1.0.0)
- SwinjectStoryboard (= 1.0.0)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Cobra
- Gorgon
- PromiseKit
- Swinject
- SwinjectPropertyLoader
- SwinjectStoryboard

SPEC CHECKSUMS:
Cobra: c943194f96fc856e929a484bc631746022911f13
Gorgon: 284c4e96706a7ae95def57fd6646aac1a487fb42
Expand All @@ -34,4 +43,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 786a32157904c16e3737b6885ed6cef3914ca872

COCOAPODS: 1.1.1
COCOAPODS: 1.6.2