Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
updated to swift 5 (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsalkul authored and sunjunkie committed Aug 5, 2019
1 parent 338761c commit 774e14e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 23 deletions.
24 changes: 11 additions & 13 deletions Powerup.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -532,22 +532,23 @@
attributes = {
LastSwiftMigration = 0730;
LastSwiftUpdateCheck = 0930;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Systers;
TargetAttributes = {
2A0CA54E1B294C6B00ED8781 = {
CreatedOnToolsVersion = 6.3.2;
DevelopmentTeam = MZWL92LA7S;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
};
2A0CA5631B294C6B00ED8781 = {
CreatedOnToolsVersion = 6.3.2;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
TestTargetID = 2A0CA54E1B294C6B00ED8781;
};
6A9353E120BD131700A6D196 = {
CreatedOnToolsVersion = 9.3.1;
DevelopmentTeam = MZWL92LA7S;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
TestTargetID = 2A0CA54E1B294C6B00ED8781;
};
Expand All @@ -558,6 +559,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -857,8 +859,7 @@
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Powerup-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand All @@ -880,8 +881,7 @@
PRODUCT_NAME = Powerup;
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Powerup-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand All @@ -901,8 +901,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = PowerupTests;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Powerup.app/Powerup";
};
name = Debug;
Expand All @@ -917,8 +916,7 @@
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = PowerupTests;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Powerup.app/Powerup";
};
name = Release;
Expand All @@ -944,7 +942,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.example.PowerupUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Powerup;
};
Expand All @@ -971,7 +969,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.example.PowerupUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Powerup;
};
Expand Down
2 changes: 1 addition & 1 deletion Powerup.xcodeproj/xcshareddata/xcschemes/Powerup.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Powerup/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}

Expand Down
4 changes: 2 additions & 2 deletions Powerup/OOC-Event-Classes/Animate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Animate {
MARK: Init
******************************* */
private var duration: Double,
options: UIViewAnimationOptions = [.curveEaseOut],
options: UIView.AnimationOptions = [.curveEaseOut],
delay: Double = 0,
damping: CGFloat = 1,
velocity: CGFloat = 1,
Expand Down Expand Up @@ -55,7 +55,7 @@ class Animate {

See `UIView.animate(options: UIViewAnimationOptions)` for more information.
*/
@discardableResult func setOptions(_ options: UIViewAnimationOptions) -> Animate {
@discardableResult func setOptions(_ options: UIView.AnimationOptions) -> Animate {
self.options = options
return self
}
Expand Down
7 changes: 6 additions & 1 deletion Powerup/OOC-Event-Classes/SoundPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SoundPlayer {

init () {
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category(rawValue: convertFromAVAudioSessionCategory(AVAudioSession.Category.playback)))
try AVAudioSession.sharedInstance().setActive(true)
} catch let error {
print(error.localizedDescription)
Expand Down Expand Up @@ -53,3 +53,8 @@ class SoundPlayer {
}

}

// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromAVAudioSessionCategory(_ input: AVAudioSession.Category) -> String {
return input.rawValue
}
6 changes: 3 additions & 3 deletions Powerup/OOC-Event-Classes/StorySequencePlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ class StorySequencePlayer: UIView {
- Parameter view: Target `UIView`.
- Parameter style: Desired `UIBlueEffectStyle`.
*/
private func addBlur(_ view: UIView, _ style: UIBlurEffectStyle) {
let blur = UIBlurEffect(style: UIBlurEffectStyle.dark)
private func addBlur(_ view: UIView, _ style: UIBlurEffect.Style) {
let blur = UIBlurEffect(style: UIBlurEffect.Style.dark)
let blurView = UIVisualEffectView(effect: blur)
blurView.frame = view.bounds
blurView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
Expand Down Expand Up @@ -287,7 +287,7 @@ class StorySequencePlayer: UIView {
Check if a long press has begun. If so, call `displaySkipWarning()`.
*/
@objc private func lpView(_ sender: UILongPressGestureRecognizer) {
if sender.state == UIGestureRecognizerState.began {
if sender.state == UIGestureRecognizer.State.began {
displaySkipWarning()
}
}
Expand Down
2 changes: 1 addition & 1 deletion Powerup/ScenarioViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ScenarioViewController: UIViewController, UITableViewDelegate, UITableView
// Configure table cells.
// Set cell height according to the TableView height.
choicesTableView.rowHeight = (choicesTableView.frame.size.height / 3).rounded()
choicesTableView.contentInset = UIEdgeInsetsMake(0, -2, 0, -35)
choicesTableView.contentInset = UIEdgeInsets.init(top: 0, left: -2, bottom: 0, right: -35)

// TODO: Configure the image and name of the "Asker" avatar.

Expand Down
2 changes: 1 addition & 1 deletion PowerupTests/ShopViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class ShopViewControllerTests: XCTestCase {
XCTAssertEqual(shopViewController.priceLabels[boxIndex].text, String(5))
} else {
// Since there are no other hairs, the other boxes should be unavailable.
XCTAssertEqual(UIImagePNGRepresentation(shopViewController.displayBoxes[boxIndex].image!), UIImagePNGRepresentation(UIImage()))
XCTAssertEqual(shopViewController.displayBoxes[boxIndex].image!.pngData(), UIImage().pngData())
XCTAssertEqual(shopViewController.priceLabels[boxIndex].text, "")
XCTAssertTrue(shopViewController.purchasedCheckmark[boxIndex].isHidden)
XCTAssertEqual(shopViewController.displayImages[boxIndex].image, nil)
Expand Down

0 comments on commit 774e14e

Please sign in to comment.