Skip to content

Commit

Permalink
Migration new Swift 4.2 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
virakri committed Oct 11, 2018
1 parent 0d10d7a commit 96676b4
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 47 deletions.
43 changes: 7 additions & 36 deletions Kumi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@
8EC736C81EB28CB60087846F /* Frameworks */,
8EC736C91EB28CB60087846F /* Headers */,
8EC736CA1EB28CB60087846F /* Resources */,
F68C48B0799D420181B3BF70 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -435,7 +434,6 @@
8EC736D21EB28CB60087846F /* Frameworks */,
8EC736D31EB28CB60087846F /* Resources */,
C8DF7ABC0BCFF8F77D3A256F /* [CP] Embed Pods Frameworks */,
ED88623CA29617BB06C23BB6 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -454,12 +452,11 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Prolific Interactive";
TargetAttributes = {
8EC736CB1EB28CB60087846F = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = 5ZZ7W4SB26;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
Expand Down Expand Up @@ -575,36 +572,6 @@
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;
};
ED88623CA29617BB06C23BB6 /* [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-KumiTests/Pods-KumiTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
F68C48B0799D420181B3BF70 /* [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-Kumi/Pods-Kumi-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -692,13 +659,15 @@
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_DOCUMENTATION_COMMENTS = YES;
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;
Expand Down Expand Up @@ -752,13 +721,15 @@
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_DOCUMENTATION_COMMENTS = YES;
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;
Expand Down Expand Up @@ -798,7 +769,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 5ZZ7W4SB26;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -820,7 +791,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 5ZZ7W4SB26;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down
8 changes: 3 additions & 5 deletions Kumi.xcodeproj/xcshareddata/xcschemes/Kumi.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,9 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -57,7 +56,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions Kumi.xcodeproj/xcshareddata/xcschemes/KumiTests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -10,7 +10,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand All @@ -31,7 +30,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
8 changes: 8 additions & 0 deletions Kumi.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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>
24 changes: 21 additions & 3 deletions Kumi/Core/Animation/UIViewAnimationStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ public struct UIViewAnimationStyle {

/// The view animation velocity.
public let velocity: CGFloat

/// The view animation options.
#if swift(>=4.2)
public let options: UIView.AnimationOptions
#else
public let options: UIViewAnimationOptions

#endif

/// Initializes the view animation style.
///
/// - Parameters:
Expand All @@ -34,6 +38,19 @@ public struct UIViewAnimationStyle {
/// - dampingRatio: The damping ratio to use.
/// - velocity: The velocity to use.
/// - options: The options to use.
#if swift(>=4.2)
public init(duration: TimeInterval,
delay: TimeInterval = 0,
dampingRatio: CGFloat = 1,
velocity: CGFloat = 0,
options: UIView.AnimationOptions = [.allowUserInteraction]) {
self.duration = duration
self.delay = delay
self.dampingRatio = dampingRatio
self.velocity = velocity
self.options = options
}
#else
public init(duration: TimeInterval,
delay: TimeInterval = 0,
dampingRatio: CGFloat = 1,
Expand All @@ -45,5 +62,6 @@ public struct UIViewAnimationStyle {
self.velocity = velocity
self.options = options
}

#endif

}
20 changes: 20 additions & 0 deletions Kumi/Core/Utility/TextStyle+JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,35 @@ private extension NSUnderlineStyle {
static func fromString(string: String) -> NSUnderlineStyle? {
switch string {
case "none":
#if swift(>=4.2)
return nil
#else
return NSUnderlineStyle.styleNone
#endif
case "single":
#if swift(>=4.2)
return NSUnderlineStyle.single
#else
return NSUnderlineStyle.styleSingle
#endif
case "thick":
#if swift(>=4.2)
return NSUnderlineStyle.thick
#else
return NSUnderlineStyle.styleThick
#endif
case "double":
#if swift(>=4.2)
return NSUnderlineStyle.double
#else
return NSUnderlineStyle.styleDouble
#endif
case "patternSolid":
#if swift(>=4.2)
return nil
#else
return NSUnderlineStyle.patternSolid
#endif
case "patternDot":
return NSUnderlineStyle.patternDot
case "patternDash":
Expand Down

0 comments on commit 96676b4

Please sign in to comment.