Skip to content

Commit 0193aa6

Browse files
authored
Merge pull request #224 from AliSoftware/swift5
Swift 5
2 parents a4f0256 + de7ad3a commit 0193aa6

24 files changed

+394
-469
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2
1+
5.0.1

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ matrix:
55
- script:
66
- set -o pipefail && xcodebuild test -workspace Dip.xcworkspace -scheme Dip -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' ONLY_ACTIVE_ARCH=NO | xcpretty -c
77
- set -o pipefail && xcodebuild test -workspace Dip.xcworkspace -scheme Dip -sdk macosx -destination 'platform=macOS,arch=x86_64' ONLY_ACTIVE_ARCH=NO | xcpretty -c
8-
- pod spec lint --allow-warnings
8+
# - pod spec lint --allow-warnings
99
- carthage build --no-skip-current
1010
- swift package clean && swift build && swift test
1111
os: osx
12-
osx_image: xcode10
12+
osx_image: xcode10.2
1313
language: objective-c
1414
before_install:
1515
- gem install cocoapods --version 1.4.0 --no-document
@@ -22,8 +22,8 @@ matrix:
2222
before_install:
2323
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
2424
- cd ..
25-
- export SWIFT_VERSION=swift-4.2-RELEASE
26-
- wget https://swift.org/builds/swift-4.2-release/ubuntu1404/$SWIFT_VERSION/$SWIFT_VERSION-ubuntu14.04.tar.gz
25+
- export SWIFT_VERSION=swift-5.0-RELEASE
26+
- wget https://swift.org/builds/swift-5.0-release/ubuntu1404/$SWIFT_VERSION/$SWIFT_VERSION-ubuntu14.04.tar.gz
2727
- tar xzf $SWIFT_VERSION-ubuntu14.04.tar.gz
2828
- export PATH="${PWD}/${SWIFT_VERSION}-ubuntu14.04/usr/bin:${PATH}"
2929
- cd Dip

Dip/Dip.xcodeproj/project.pbxproj

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,25 +221,26 @@
221221
isa = PBXProject;
222222
attributes = {
223223
LastSwiftUpdateCheck = 0730;
224-
LastUpgradeCheck = 0930;
224+
LastUpgradeCheck = 1020;
225225
ORGANIZATIONNAME = AliSoftware;
226226
TargetAttributes = {
227227
0903B3571C161543002241C1 = {
228228
CreatedOnToolsVersion = 7.1.1;
229-
LastSwiftMigration = 0800;
229+
LastSwiftMigration = 1020;
230230
};
231231
0903B3601C161543002241C1 = {
232232
CreatedOnToolsVersion = 7.1.1;
233-
LastSwiftMigration = 0800;
233+
LastSwiftMigration = 1020;
234234
};
235235
};
236236
};
237237
buildConfigurationList = 0945268B1BEA1CFF0034E72A /* Build configuration list for PBXProject "Dip" */;
238238
compatibilityVersion = "Xcode 3.2";
239-
developmentRegion = English;
239+
developmentRegion = en;
240240
hasScannedForEncodings = 0;
241241
knownRegions = (
242242
en,
243+
Base,
243244
);
244245
mainGroup = 094526871BEA1CFF0034E72A;
245246
productRefGroup = 094526921BEA1CFF0034E72A /* Products */;
@@ -360,7 +361,7 @@
360361
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.Dip;
361362
PRODUCT_NAME = Dip;
362363
SKIP_INSTALL = YES;
363-
SWIFT_VERSION = 4.2;
364+
SWIFT_VERSION = 5.0;
364365
};
365366
name = Debug;
366367
};
@@ -380,7 +381,7 @@
380381
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.Dip;
381382
PRODUCT_NAME = Dip;
382383
SKIP_INSTALL = YES;
383-
SWIFT_VERSION = 4.2;
384+
SWIFT_VERSION = 5.0;
384385
};
385386
name = Release;
386387
};
@@ -402,7 +403,7 @@
402403
"STORYBOARD_NAME_PREFIX[sdk=iphoneos*]" = UI;
403404
"STORYBOARD_NAME_PREFIX[sdk=iphonesimulator*]" = UI;
404405
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
405-
SWIFT_VERSION = 4.2;
406+
SWIFT_VERSION = 5.0;
406407
};
407408
name = Debug;
408409
};
@@ -419,14 +420,15 @@
419420
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.DipTests;
420421
PRODUCT_NAME = "$(TARGET_NAME)";
421422
STORYBOARD_NAME_PREFIX = "";
422-
SWIFT_VERSION = 4.2;
423+
SWIFT_VERSION = 5.0;
423424
};
424425
name = Release;
425426
};
426427
094526A31BEA1CFF0034E72A /* Debug */ = {
427428
isa = XCBuildConfiguration;
428429
buildSettings = {
429430
ALWAYS_SEARCH_USER_PATHS = NO;
431+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
430432
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
431433
CLANG_CXX_LIBRARY = "libc++";
432434
CLANG_ENABLE_MODULES = YES;
@@ -477,7 +479,7 @@
477479
ONLY_ACTIVE_ARCH = YES;
478480
SUPPORTED_PLATFORMS = "macosx watchsimulator iphonesimulator appletvsimulator watchos appletvos iphoneos";
479481
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
480-
SWIFT_VERSION = 4.0;
482+
SWIFT_VERSION = 5.0;
481483
TARGETED_DEVICE_FAMILY = "1,2,3,4";
482484
TVOS_DEPLOYMENT_TARGET = 9.0;
483485
VERSIONING_SYSTEM = "apple-generic";
@@ -490,6 +492,7 @@
490492
isa = XCBuildConfiguration;
491493
buildSettings = {
492494
ALWAYS_SEARCH_USER_PATHS = NO;
495+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
493496
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
494497
CLANG_CXX_LIBRARY = "libc++";
495498
CLANG_ENABLE_MODULES = YES;
@@ -533,7 +536,7 @@
533536
MTL_ENABLE_DEBUG_INFO = NO;
534537
SUPPORTED_PLATFORMS = "macosx watchsimulator iphonesimulator appletvsimulator watchos appletvos iphoneos";
535538
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
536-
SWIFT_VERSION = 4.0;
539+
SWIFT_VERSION = 5.0;
537540
TARGETED_DEVICE_FAMILY = "1,2,3,4";
538541
TVOS_DEPLOYMENT_TARGET = 9.0;
539542
VALIDATE_PRODUCT = YES;

Dip/Dip.xcodeproj/xcshareddata/xcschemes/Dip.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

LinuxMain.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import XCTest
2+
3+
import DipTests
4+
5+
var tests = [XCTestCaseEntry]()
6+
tests += DipTests.__allTests()
7+
8+
XCTMain(tests)

Package.swift

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
1-
//
2-
// Dip
3-
//
4-
// Copyright (c) 2015 Olivier Halligon <olivier@halligon.net>
5-
//
6-
// Permission is hereby granted, free of charge, to any person obtaining a copy
7-
// of this software and associated documentation files (the "Software"), to deal
8-
// in the Software without restriction, including without limitation the rights
9-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
// copies of the Software, and to permit persons to whom the Software is
11-
// furnished to do so, subject to the following conditions:
12-
//
13-
// The above copyright notice and this permission notice shall be included in
14-
// all copies or substantial portions of the Software.
15-
//
16-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
// THE SOFTWARE.
23-
//
1+
// swift-tools-version:5.0
242

253
import PackageDescription
264

275
let package = Package(
28-
name: "Dip"
6+
name: "Dip",
7+
products: [
8+
.library(name: "Dip", targets: ["Dip"]),
9+
],
10+
targets: [
11+
.target(name: "Dip", dependencies: [], path: "Sources"),
12+
.testTarget(name: "DipTests", dependencies: ["Dip"], path: "Tests"),
13+
]
2914
)
3015

SampleApp/DipSampleApp.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@
279279
isa = PBXProject;
280280
attributes = {
281281
LastSwiftUpdateCheck = 0700;
282-
LastUpgradeCheck = 0930;
282+
LastUpgradeCheck = 1020;
283283
ORGANIZATIONNAME = AliSoftware;
284284
TargetAttributes = {
285285
0990225E1BC123C000E76F43 = {
@@ -292,7 +292,7 @@
292292
};
293293
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DipSampleApp" */;
294294
compatibilityVersion = "Xcode 3.2";
295-
developmentRegion = English;
295+
developmentRegion = en;
296296
hasScannedForEncodings = 0;
297297
knownRegions = (
298298
en,
@@ -423,6 +423,7 @@
423423
isa = XCBuildConfiguration;
424424
buildSettings = {
425425
ALWAYS_SEARCH_USER_PATHS = NO;
426+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
426427
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
427428
CLANG_CXX_LIBRARY = "libc++";
428429
CLANG_ENABLE_MODULES = YES;
@@ -479,6 +480,7 @@
479480
isa = XCBuildConfiguration;
480481
buildSettings = {
481482
ALWAYS_SEARCH_USER_PATHS = NO;
483+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
482484
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
483485
CLANG_CXX_LIBRARY = "libc++";
484486
CLANG_ENABLE_MODULES = YES;

SampleApp/DipSampleApp.xcodeproj/xcshareddata/xcschemes/DipSampleApp.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Sources/AutoInjection.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ public final class Injected<T>: _InjectedPropertyBox<T>, AutoInjectedPropertyBox
118118
}
119119

120120
///Wrapped value.
121-
public internal(set) var value: T? {
121+
public fileprivate(set) var value: T? {
122122
didSet {
123123
if let value = value { didInject(value) }
124124
}
125125
}
126-
126+
127127
init(value: T?, required: Bool = true, tag: DependencyTagConvertible?, overrideTag: Bool, didInject: @escaping (T) -> ()) {
128128
self.value = value
129129
super.init(required: required, tag: tag, overrideTag: overrideTag, didInject: didInject)
@@ -296,5 +296,3 @@ public class _InjectedPropertyBox<T> {
296296
}
297297

298298
}
299-
300-

Sources/Compatibility.swift

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
#if _runtime(_ObjC)
2-
extension String {
3-
func has(prefix aPrefix: String) -> Bool {
4-
return hasPrefix(aPrefix)
5-
}
1+
extension String {
2+
func has(prefix aPrefix: String) -> Bool {
3+
return hasPrefix(aPrefix)
64
}
7-
8-
#else
9-
10-
extension String {
11-
func has(prefix aPrefix: String) -> Bool {
12-
return aPrefix ==
13-
String(self.characters.prefix(aPrefix.characters.count))
14-
}
15-
16-
}
17-
#endif
5+
}

0 commit comments

Comments
 (0)