Skip to content

Commit d9e58fe

Browse files
andersioRuiAAPeres
authored andcommitted
Move the Swift version target to 4.2. (#15)
1 parent 7bfcc14 commit d9e58fe

File tree

10 files changed

+25
-38
lines changed

10 files changed

+25
-38
lines changed

.swift-version

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

Cartfile.resolved

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
github "Quick/Nimble" "v8.0.1"
2-
github "Quick/Quick" "v2.0.0"
3-
github "jspahrsummers/xcconfigs" "0.12"
2+
github "Quick/Quick" "v2.1.0"
3+
github "jspahrsummers/xcconfigs" "1.0"

Carthage/Checkouts/Quick

Submodule Quick updated 34 files

Carthage/Checkouts/xcconfigs

FlexibleDiff.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
1616
s.source = { :git => "https://github.com/RACCommunity/FlexibleDiff.git", :tag => "#{s.version}" }
1717

1818
s.source_files = "FlexibleDiff/*.{swift}"
19-
s.swift_version = "5.0"
19+
s.swift_version = "4.2"
2020
end

FlexibleDiff.xcodeproj/project.pbxproj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@
839839
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
840840
PRODUCT_NAME = FlexibleDiff;
841841
SDKROOT = macosx;
842+
SWIFT_VERSION = 4.2;
842843
};
843844
name = Debug;
844845
};
@@ -853,6 +854,7 @@
853854
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
854855
PRODUCT_NAME = FlexibleDiff;
855856
SDKROOT = macosx;
857+
SWIFT_VERSION = 4.2;
856858
};
857859
name = Release;
858860
};
@@ -867,6 +869,7 @@
867869
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
868870
PRODUCT_NAME = FlexibleDiff;
869871
SDKROOT = appletvos;
872+
SWIFT_VERSION = 4.2;
870873
};
871874
name = Debug;
872875
};
@@ -881,6 +884,7 @@
881884
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
882885
PRODUCT_NAME = FlexibleDiff;
883886
SDKROOT = appletvos;
887+
SWIFT_VERSION = 4.2;
884888
};
885889
name = Release;
886890
};
@@ -945,7 +949,7 @@
945949
PRODUCT_NAME = FlexibleDiffTests;
946950
SDKROOT = iphoneos;
947951
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
948-
SWIFT_VERSION = 5.0;
952+
SWIFT_VERSION = 4.2;
949953
TARGETED_DEVICE_FAMILY = "1,2";
950954
};
951955
name = Debug;
@@ -1003,7 +1007,7 @@
10031007
PRODUCT_NAME = FlexibleDiffTests;
10041008
SDKROOT = iphoneos;
10051009
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
1006-
SWIFT_VERSION = 5.0;
1010+
SWIFT_VERSION = 4.2;
10071011
TARGETED_DEVICE_FAMILY = "1,2";
10081012
VALIDATE_PRODUCT = YES;
10091013
};
@@ -1268,6 +1272,7 @@
12681272
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.WordList;
12691273
PRODUCT_NAME = "$(TARGET_NAME)";
12701274
SDKROOT = iphoneos;
1275+
SWIFT_VERSION = 4.2;
12711276
TARGETED_DEVICE_FAMILY = "1,2";
12721277
};
12731278
name = Debug;
@@ -1284,6 +1289,7 @@
12841289
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.WordList;
12851290
PRODUCT_NAME = "$(TARGET_NAME)";
12861291
SDKROOT = iphoneos;
1292+
SWIFT_VERSION = 4.2;
12871293
TARGETED_DEVICE_FAMILY = "1,2";
12881294
};
12891295
name = Release;
@@ -1300,7 +1306,7 @@
13001306
MTL_ENABLE_DEBUG_INFO = YES;
13011307
SDKROOT = macosx;
13021308
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
1303-
SWIFT_VERSION = 4.0;
1309+
SWIFT_VERSION = 4.2;
13041310
TVOS_DEPLOYMENT_TARGET = 9.0;
13051311
VERSIONING_SYSTEM = "apple-generic";
13061312
VERSION_INFO_PREFIX = "";
@@ -1319,7 +1325,7 @@
13191325
MACOSX_DEPLOYMENT_TARGET = 10.9;
13201326
MTL_ENABLE_DEBUG_INFO = NO;
13211327
SDKROOT = macosx;
1322-
SWIFT_VERSION = 4.0;
1328+
SWIFT_VERSION = 4.2;
13231329
TVOS_DEPLOYMENT_TARGET = 9.0;
13241330
VERSIONING_SYSTEM = "apple-generic";
13251331
VERSION_INFO_PREFIX = "";
@@ -1338,7 +1344,7 @@
13381344
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
13391345
PRODUCT_NAME = FlexibleDiff;
13401346
SDKROOT = iphoneos;
1341-
SWIFT_VERSION = 5.0;
1347+
SWIFT_VERSION = 4.2;
13421348
};
13431349
name = Debug;
13441350
};
@@ -1353,7 +1359,7 @@
13531359
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
13541360
PRODUCT_NAME = FlexibleDiff;
13551361
SDKROOT = iphoneos;
1356-
SWIFT_VERSION = 5.0;
1362+
SWIFT_VERSION = 4.2;
13571363
};
13581364
name = Release;
13591365
};

WordList/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import UIKit
44
class AppDelegate: UIResponder, UIApplicationDelegate {
55
var window: UIWindow?
66

7-
func application(
7+
internal func application(
88
_ application: UIApplication,
9-
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
9+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
1010
) -> Bool {
1111
let window = UIWindow()
1212
self.window = window

WordList/WordCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class WordCell: UITableViewCell {
44
private let wordLabel: UILabel
55
private let uuidLabel: UILabel
66

7-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
7+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
88
wordLabel = UILabel()
99
uuidLabel = UILabel()
1010

WordList/WordListViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class WordListViewController: UIViewController {
2626
tableView.dataSource = self
2727
tableView.delegate = self
2828
tableView.estimatedRowHeight = 44.0
29-
tableView.rowHeight = UITableViewAutomaticDimension
29+
tableView.rowHeight = UITableView.automaticDimension
3030
}
3131

3232
override func viewDidLoad() {
@@ -45,7 +45,7 @@ class WordListViewController: UIViewController {
4545
viewModel.userDidTapActionButton()
4646
}
4747

48-
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
48+
override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
4949
super.motionEnded(motion, with: event)
5050

5151
if motion == .motionShake {

WordList/WordListViewModel.swift

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ final class WordListViewModel {
6262
completion(true)
6363

6464
self.update { words in
65-
guard let index = words.index(where: { $0.identifier == word.identifier })
65+
guard let index = words.firstIndex(where: { $0.identifier == word.identifier })
6666
else { return }
6767
words[index] = word.updating(input)
6868
}
@@ -71,7 +71,7 @@ final class WordListViewModel {
7171

7272
func deleteWord(_ word: Word) -> Bool {
7373
return update { words in
74-
guard let index = words.index(where: { $0.identifier == word.identifier })
74+
guard let index = words.firstIndex(where: { $0.identifier == word.identifier })
7575
else { return false }
7676
words.remove(at: index)
7777
return true
@@ -118,22 +118,3 @@ final class WordListViewModel {
118118
return result
119119
}
120120
}
121-
122-
private extension RangeReplaceableCollection {
123-
func shuffled() -> Self {
124-
var elements = self
125-
126-
for i in 0 ..< Int(elements.count) {
127-
let distance = Int(arc4random() >> 1) % Int(elements.count)
128-
let random = elements.index(elements.startIndex, offsetBy: IndexDistance(distance))
129-
let index = elements.index(elements.startIndex, offsetBy: IndexDistance(i))
130-
guard random != index else { continue }
131-
132-
let temp = elements[index]
133-
elements.replaceSubrange(index ..< elements.index(after: index), with: CollectionOfOne(elements[random]))
134-
elements.replaceSubrange(random ..< elements.index(after: random), with: CollectionOfOne(temp))
135-
}
136-
137-
return elements
138-
}
139-
}

0 commit comments

Comments
 (0)