Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Updating to Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
txaiwieser committed Sep 19, 2018
1 parent fbd3707 commit 0b79803
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 30 deletions.
2 changes: 1 addition & 1 deletion TWSpriteKitUtils Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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 {
// Override point for customization after application launch.
return true
}
Expand Down
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 @@ -47,6 +57,16 @@
"filename" : "[email protected]",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down Expand Up @@ -99,6 +119,16 @@
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
},
{
"size" : "24x24",
"idiom" : "watch",
Expand Down Expand Up @@ -136,8 +166,15 @@
"size" : "44x44",
"idiom" : "watch",
"scale" : "2x",
"role" : "longLook",
"subtype" : "42mm"
"role" : "appLauncher",
"subtype" : "40mm"
},
{
"size" : "50x50",
"idiom" : "watch",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "44mm"
},
{
"size" : "86x86",
Expand All @@ -153,6 +190,18 @@
"role" : "quickLook",
"subtype" : "42mm"
},
{
"size" : "108x108",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "44mm"
},
{
"idiom" : "watch-marketing",
"size" : "1024x1024",
"scale" : "1x"
},
{
"idiom" : "car",
"size" : "120x120",
Expand All @@ -163,6 +212,13 @@
"idiom" : "watch",
"role" : "appLauncher",
"scale" : "2x"
},
{
"size" : "44x44",
"idiom" : "watch",
"scale" : "2x",
"role" : "longLook",
"subtype" : "42mm"
}
],
"info" : {
Expand Down
30 changes: 23 additions & 7 deletions TWSpriteKitUtils.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,16 @@
E9099ABF1B9F589400758069 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Txai Wieser";
TargetAttributes = {
E9099AC71B9F589500758069 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
E9306C721BAAEF15003A900C = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -386,14 +386,22 @@
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;
Expand Down Expand Up @@ -436,14 +444,22 @@
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;
Expand Down Expand Up @@ -490,7 +506,7 @@
PRODUCT_BUNDLE_IDENTIFIER = TDW.TWSpriteKitUtils;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -512,7 +528,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -526,7 +542,7 @@
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "TDW.TWSpriteKitUtils-Demo";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -540,7 +556,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "TDW.TWSpriteKitUtils-Demo";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
34 changes: 17 additions & 17 deletions TWSpriteKitUtils/TWControls/TWControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,16 @@ open class TWControl: SKNode {

// MARK: Sound Properties

open static var defaultSoundEffectsEnabled: Bool? = nil
public static var defaultSoundEffectsEnabled: Bool? = nil
open var soundEffectsEnabled: Bool = true

open static var defaultTouchDownSoundFileName: String? {
public static var defaultTouchDownSoundFileName: String? {
didSet { soundPreLoad(defaultTouchDownSoundFileName) }
}
open static var defaultTouchUpSoundFileName: String? {
public static var defaultTouchUpSoundFileName: String? {
didSet { soundPreLoad(defaultTouchUpSoundFileName) }
}
open static var defaultDisabledTouchDownFileName: String? {
public static var defaultDisabledTouchDownFileName: String? {
didSet { soundPreLoad(defaultDisabledTouchDownFileName) }
}

Expand Down Expand Up @@ -402,7 +402,7 @@ open class TWControl: SKNode {

// Labels Text Setters

open static var defaultLabelFont = "Helvetica-Neue"
public static var defaultLabelFont = "Helvetica-Neue"

open func setNormalStateLabelText(_ text: String?) {
self.setLabelText(&normalStateLabel, text: text, pos: normalStateLabelPosition)
Expand Down Expand Up @@ -498,13 +498,13 @@ open class TWControl: SKNode {

// Default Control Label Position

open static var defaultNormalStateLabelPosition = CGPoint.zero
open static var defaultSelectedStateLabelPosition = CGPoint.zero
open static var defaultDisabledStateLabelPosition = CGPoint.zero
open static var defaultHighlightedStateSingleLabelPosition = CGPoint.zero
open static var defaultHighlightedStateMultiLabelPositionFromNormal = CGPoint.zero
open static var defaultHighlightedStateMultiLabelPositionFromSelected = CGPoint.zero
open static func setAllDefaultStatesLabelPosition(_ pos: CGPoint) {
public static var defaultNormalStateLabelPosition = CGPoint.zero
public static var defaultSelectedStateLabelPosition = CGPoint.zero
public static var defaultDisabledStateLabelPosition = CGPoint.zero
public static var defaultHighlightedStateSingleLabelPosition = CGPoint.zero
public static var defaultHighlightedStateMultiLabelPositionFromNormal = CGPoint.zero
public static var defaultHighlightedStateMultiLabelPositionFromSelected = CGPoint.zero
public static func setAllDefaultStatesLabelPosition(_ pos: CGPoint) {
defaultNormalStateLabelPosition = pos
defaultSelectedStateLabelPosition = pos
defaultDisabledStateLabelPosition = pos
Expand Down Expand Up @@ -545,7 +545,7 @@ open class TWControl: SKNode {

// Control Animations

open static var defaultAnimationHighlightedAction: (to: SKAction, back: SKAction)? = nil
public static var defaultAnimationHighlightedAction: (to: SKAction, back: SKAction)? = nil
open var animationHighlightedAction: (to: SKAction, back: SKAction)? = defaultAnimationHighlightedAction


Expand Down Expand Up @@ -786,12 +786,12 @@ open class TWControl: SKNode {
// MARK: Control Events

internal func touchDown() {
playSound(instanceSoundFileName: touchDownSoundFileName, defaultSoundFileName: type(of: self).defaultTouchDownSoundFileName)
playSound(instanceSoundFileName: touchDownSoundFileName, defaultSoundFileName: TWControl.defaultTouchDownSoundFileName)
executeClosures(of: .touchDown)
}

internal func disabledTouchDown() {
playSound(instanceSoundFileName: disabledTouchDownFileName, defaultSoundFileName: type(of: self).defaultDisabledTouchDownFileName)
playSound(instanceSoundFileName: disabledTouchDownFileName, defaultSoundFileName: TWControl.defaultDisabledTouchDownFileName)
executeClosures(of: .disabledTouchDown)
}

Expand All @@ -815,12 +815,12 @@ open class TWControl: SKNode {

open func touchUpInside() {
executeClosures(of: .touchUpInside)
playSound(instanceSoundFileName: touchUpSoundFileName, defaultSoundFileName: type(of: self).defaultTouchUpSoundFileName)
playSound(instanceSoundFileName: touchUpSoundFileName, defaultSoundFileName: TWControl.defaultTouchUpSoundFileName)
}

internal func touchUpOutside() {
executeClosures(of: .touchUpOutside)
playSound(instanceSoundFileName: touchUpSoundFileName, defaultSoundFileName: type(of: self).defaultTouchUpSoundFileName)
playSound(instanceSoundFileName: touchUpSoundFileName, defaultSoundFileName: TWControl.defaultTouchUpSoundFileName)
}


Expand Down
6 changes: 3 additions & 3 deletions TWSpriteKitUtils/TWLayout/TWStackNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import SpriteKit


open class TWStackNode: SKSpriteNode {
open fileprivate(set) var fillMode: FillMode = FillMode.vertical
open fileprivate(set) var subNodes: [SKNode] = []
open let automaticSpacing: Bool
open private(set) var fillMode: FillMode = FillMode.vertical
open private(set) var subNodes: [SKNode] = []
public let automaticSpacing: Bool

required public init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
public init(lenght: CGFloat, fillMode: FillMode) {
Expand Down

0 comments on commit 0b79803

Please sign in to comment.