Skip to content

Commit 671a67e

Browse files
author
Rob Rix
authored
Merge pull request #34 from alexfish/master
Convert to swift3
2 parents becbb81 + 553af10 commit 671a67e

File tree

7 files changed

+38
-20
lines changed

7 files changed

+38
-20
lines changed

Box.xcodeproj/project.pbxproj

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
isa = PBXProject;
257257
attributes = {
258258
LastSwiftUpdateCheck = 0700;
259-
LastUpgradeCheck = 0700;
259+
LastUpgradeCheck = 0800;
260260
ORGANIZATIONNAME = "Rob Rix";
261261
TargetAttributes = {
262262
D470AC3619E86128003DA6C6 = {
@@ -267,9 +267,11 @@
267267
};
268268
F8BB81D21A939B66001AA352 = {
269269
CreatedOnToolsVersion = 6.3;
270+
LastSwiftMigration = 0800;
270271
};
271272
F8BB81DC1A939B67001AA352 = {
272273
CreatedOnToolsVersion = 6.3;
274+
LastSwiftMigration = 0800;
273275
};
274276
};
275277
};
@@ -394,15 +396,19 @@
394396
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
395397
CLANG_WARN_EMPTY_BODY = YES;
396398
CLANG_WARN_ENUM_CONVERSION = YES;
399+
CLANG_WARN_INFINITE_RECURSION = YES;
397400
CLANG_WARN_INT_CONVERSION = YES;
398401
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
402+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
399403
CLANG_WARN_UNREACHABLE_CODE = YES;
400404
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
401405
COPY_PHASE_STRIP = NO;
402406
CURRENT_PROJECT_VERSION = 1;
403407
ENABLE_STRICT_OBJC_MSGSEND = YES;
408+
ENABLE_TESTABILITY = YES;
404409
GCC_C_LANGUAGE_STANDARD = gnu99;
405410
GCC_DYNAMIC_NO_PIC = NO;
411+
GCC_NO_COMMON_BLOCKS = YES;
406412
GCC_OPTIMIZATION_LEVEL = 0;
407413
GCC_PREPROCESSOR_DEFINITIONS = (
408414
"DEBUG=1",
@@ -440,8 +446,10 @@
440446
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
441447
CLANG_WARN_EMPTY_BODY = YES;
442448
CLANG_WARN_ENUM_CONVERSION = YES;
449+
CLANG_WARN_INFINITE_RECURSION = YES;
443450
CLANG_WARN_INT_CONVERSION = YES;
444451
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
452+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
445453
CLANG_WARN_UNREACHABLE_CODE = YES;
446454
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
447455
COPY_PHASE_STRIP = YES;
@@ -450,6 +458,7 @@
450458
ENABLE_NS_ASSERTIONS = NO;
451459
ENABLE_STRICT_OBJC_MSGSEND = YES;
452460
GCC_C_LANGUAGE_STANDARD = gnu99;
461+
GCC_NO_COMMON_BLOCKS = YES;
453462
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
454463
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
455464
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -461,6 +470,7 @@
461470
MTL_ENABLE_DEBUG_INFO = NO;
462471
PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)";
463472
SDKROOT = macosx;
473+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
464474
VERSIONING_SYSTEM = "apple-generic";
465475
VERSION_INFO_PREFIX = "";
466476
};
@@ -521,6 +531,7 @@
521531
);
522532
INFOPLIST_FILE = BoxTests/Info.plist;
523533
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
534+
PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)";
524535
PRODUCT_NAME = "$(TARGET_NAME)";
525536
};
526537
name = Debug;
@@ -535,6 +546,7 @@
535546
);
536547
INFOPLIST_FILE = BoxTests/Info.plist;
537548
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
549+
PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)";
538550
PRODUCT_NAME = "$(TARGET_NAME)";
539551
};
540552
name = Release;
@@ -559,6 +571,7 @@
559571
PRODUCT_NAME = Box;
560572
SDKROOT = iphoneos;
561573
SKIP_INSTALL = YES;
574+
SWIFT_VERSION = 3.0;
562575
TARGETED_DEVICE_FAMILY = "1,2";
563576
};
564577
name = Debug;
@@ -579,6 +592,7 @@
579592
PRODUCT_NAME = Box;
580593
SDKROOT = iphoneos;
581594
SKIP_INSTALL = YES;
595+
SWIFT_VERSION = 3.0;
582596
TARGETED_DEVICE_FAMILY = "1,2";
583597
VALIDATE_PRODUCT = YES;
584598
};
@@ -599,8 +613,10 @@
599613
);
600614
INFOPLIST_FILE = BoxTests/Info.plist;
601615
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
616+
PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)";
602617
PRODUCT_NAME = "$(TARGET_NAME)";
603618
SDKROOT = iphoneos;
619+
SWIFT_VERSION = 3.0;
604620
};
605621
name = Debug;
606622
};
@@ -615,8 +631,10 @@
615631
);
616632
INFOPLIST_FILE = BoxTests/Info.plist;
617633
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
634+
PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)";
618635
PRODUCT_NAME = "$(TARGET_NAME)";
619636
SDKROOT = iphoneos;
637+
SWIFT_VERSION = 3.0;
620638
VALIDATE_PRODUCT = YES;
621639
};
622640
name = Release;

Box.xcodeproj/xcshareddata/xcschemes/Box-Mac.xcscheme

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -37,10 +37,10 @@
3737
</BuildActionEntries>
3838
</BuildAction>
3939
<TestAction
40+
buildConfiguration = "Debug"
4041
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4142
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42-
shouldUseLaunchSchemeArgsEnv = "YES"
43-
buildConfiguration = "Debug">
43+
shouldUseLaunchSchemeArgsEnv = "YES">
4444
<Testables>
4545
<TestableReference
4646
skipped = "NO">
@@ -66,11 +66,11 @@
6666
</AdditionalOptions>
6767
</TestAction>
6868
<LaunchAction
69+
buildConfiguration = "Debug"
6970
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7071
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
7172
launchStyle = "0"
7273
useCustomWorkingDirectory = "NO"
73-
buildConfiguration = "Debug"
7474
ignoresPersistentStateOnLaunch = "NO"
7575
debugDocumentVersioning = "YES"
7676
debugServiceExtension = "internal"
@@ -88,10 +88,10 @@
8888
</AdditionalOptions>
8989
</LaunchAction>
9090
<ProfileAction
91+
buildConfiguration = "Release"
9192
shouldUseLaunchSchemeArgsEnv = "YES"
9293
savedToolIdentifier = ""
9394
useCustomWorkingDirectory = "NO"
94-
buildConfiguration = "Release"
9595
debugDocumentVersioning = "YES">
9696
<MacroExpansion>
9797
<BuildableReference

Box.xcodeproj/xcshareddata/xcschemes/Box-iOS.xcscheme

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -37,10 +37,10 @@
3737
</BuildActionEntries>
3838
</BuildAction>
3939
<TestAction
40+
buildConfiguration = "Debug"
4041
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4142
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42-
shouldUseLaunchSchemeArgsEnv = "YES"
43-
buildConfiguration = "Debug">
43+
shouldUseLaunchSchemeArgsEnv = "YES">
4444
<Testables>
4545
<TestableReference
4646
skipped = "NO">
@@ -66,11 +66,11 @@
6666
</AdditionalOptions>
6767
</TestAction>
6868
<LaunchAction
69+
buildConfiguration = "Debug"
6970
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7071
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
7172
launchStyle = "0"
7273
useCustomWorkingDirectory = "NO"
73-
buildConfiguration = "Debug"
7474
ignoresPersistentStateOnLaunch = "NO"
7575
debugDocumentVersioning = "YES"
7676
debugServiceExtension = "internal"
@@ -88,10 +88,10 @@
8888
</AdditionalOptions>
8989
</LaunchAction>
9090
<ProfileAction
91+
buildConfiguration = "Release"
9192
shouldUseLaunchSchemeArgsEnv = "YES"
9293
savedToolIdentifier = ""
9394
useCustomWorkingDirectory = "NO"
94-
buildConfiguration = "Release"
9595
debugDocumentVersioning = "YES">
9696
<MacroExpansion>
9797
<BuildableReference

Box/Box.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public final class Box<T>: BoxType, CustomStringConvertible {
1111

1212

1313
/// Constructs a `Box` with the given `value`.
14-
public class func unit(value: T) -> Box<T> {
14+
public class func unit(_ value: T) -> Box<T> {
1515
return Box(value)
1616
}
1717

@@ -20,14 +20,14 @@ public final class Box<T>: BoxType, CustomStringConvertible {
2020
public let value: T
2121

2222
/// Constructs a new Box by transforming `value` by `f`.
23-
public func map<U>(@noescape f: T -> U) -> Box<U> {
23+
public func map<U>(_ f: (T) -> U) -> Box<U> {
2424
return Box<U>(f(value))
2525
}
2626

2727

2828
// MARK: Printable
2929

3030
public var description: String {
31-
return String(value)
31+
return String(describing: value)
3232
}
3333
}

Box/BoxType.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ public protocol MutableBoxType: BoxType {
2626
/// Equality of `BoxType`s of `Equatable` types.
2727
///
2828
/// We cannot declare that e.g. `Box<T: Equatable>` conforms to `Equatable`, so this is a relatively ad hoc definition.
29-
public func == <B: BoxType where B.Value: Equatable> (lhs: B, rhs: B) -> Bool {
29+
public func == <B: BoxType> (lhs: B, rhs: B) -> Bool where B.Value: Equatable {
3030
return lhs.value == rhs.value
3131
}
3232

3333
/// Inequality of `BoxType`s of `Equatable` types.
3434
///
3535
/// We cannot declare that e.g. `Box<T: Equatable>` conforms to `Equatable`, so this is a relatively ad hoc definition.
36-
public func != <B: BoxType where B.Value: Equatable> (lhs: B, rhs: B) -> Bool {
36+
public func != <B: BoxType> (lhs: B, rhs: B) -> Bool where B.Value: Equatable {
3737
return lhs.value != rhs.value
3838
}
3939

4040

4141
// MARK: Map
4242

4343
/// Maps the value of a box into a new box.
44-
public func map<B: BoxType, C: BoxType>(v: B, @noescape f: B.Value -> C.Value) -> C {
44+
public func map<B: BoxType, C: BoxType>(_ v: B, f: (B.Value) -> C.Value) -> C {
4545
return C(f(v.value))
4646
}

Box/MutableBox.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public final class MutableBox<T>: MutableBoxType, CustomStringConvertible {
1515
public var value: T
1616

1717
/// Constructs a new MutableBox by transforming `value` by `f`.
18-
public func map<U>(@noescape f: T -> U) -> MutableBox<U> {
18+
public func map<U>(_ f: (T) -> U) -> MutableBox<U> {
1919
return MutableBox<U>(f(value))
2020
}
2121

2222
// MARK: Printable
2323

2424
public var description: String {
25-
return String(value)
25+
return String(describing: value)
2626
}
2727
}

BoxTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>$(EXECUTABLE_NAME)</string>
99
<key>CFBundleIdentifier</key>
10-
<string>com.antitypical.$(PRODUCT_NAME:rfc1034identifier)</string>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundleName</key>

0 commit comments

Comments
 (0)