Skip to content

Commit

Permalink
Move the Swift version target to 4.2. (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersio authored and RuiAAPeres committed Apr 18, 2019
1 parent 7bfcc14 commit d9e58fe
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0
4.2
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Quick/Nimble" "v8.0.1"
github "Quick/Quick" "v2.0.0"
github "jspahrsummers/xcconfigs" "0.12"
github "Quick/Quick" "v2.1.0"
github "jspahrsummers/xcconfigs" "1.0"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
Submodule Quick updated 34 files
+1 −1 .hound.yml
+12 −4 .travis.yml
+1 −1 Externals/Nimble
+31 −27 Gemfile.lock
+8 −3 Package.swift
+42 −0 Package@swift-4.2.swift
+1 −1 Quick.podspec
+69 −36 Quick.xcodeproj/project.pbxproj
+1 −1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme
+1 −1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-macOS.xcscheme
+1 −1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-tvOS.xcscheme
+4 −4 Rakefile
+14 −3 Sources/Quick/Callsite.swift
+10 −10 Sources/Quick/DSL/DSL.swift
+12 −12 Sources/Quick/DSL/World+DSL.swift
+1 −1 Sources/Quick/NSBundle+CurrentTestBundle.swift
+23 −7 Sources/Quick/QuickSpec.swift
+3 −6 Sources/Quick/String+C99ExtendedIdentifier.swift
+1 −1 Sources/QuickObjectiveC/QuickSpec.h
+16 −15 Tests/LinuxMain.swift
+3 −2 Tests/QuickTests/QuickTestHelpers/SpecRunner.swift
+3 −8 Tests/QuickTests/QuickTestHelpers/TestRun.swift
+4 −4 Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift
+18 −6 Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m
+8 −23 Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m
+24 −0 Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift
+0 −17 Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h
+0 −23 Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m
+57 −0 Tests/QuickTests/QuickTests/Helpers/QuickSpecRunner.swift
+1 −2 Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h
+0 −20 Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h
+0 −54 Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m
+47 −0 Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift
2 changes: 1 addition & 1 deletion Carthage/Checkouts/xcconfigs
2 changes: 1 addition & 1 deletion FlexibleDiff.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/RACCommunity/FlexibleDiff.git", :tag => "#{s.version}" }

s.source_files = "FlexibleDiff/*.{swift}"
s.swift_version = "5.0"
s.swift_version = "4.2"
end
18 changes: 12 additions & 6 deletions FlexibleDiff.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
PRODUCT_NAME = FlexibleDiff;
SDKROOT = macosx;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -853,6 +854,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
PRODUCT_NAME = FlexibleDiff;
SDKROOT = macosx;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -867,6 +869,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
PRODUCT_NAME = FlexibleDiff;
SDKROOT = appletvos;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -881,6 +884,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
PRODUCT_NAME = FlexibleDiff;
SDKROOT = appletvos;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down Expand Up @@ -945,7 +949,7 @@
PRODUCT_NAME = FlexibleDiffTests;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -1003,7 +1007,7 @@
PRODUCT_NAME = FlexibleDiffTests;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand Down Expand Up @@ -1268,6 +1272,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.WordList;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1284,6 +1289,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.WordList;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -1300,7 +1306,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -1319,7 +1325,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -1338,7 +1344,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
PRODUCT_NAME = FlexibleDiff;
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -1353,7 +1359,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactivecocoa.FlexibleDiff;
PRODUCT_NAME = FlexibleDiff;
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
4 changes: 2 additions & 2 deletions WordList/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(
internal func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let window = UIWindow()
self.window = window
Expand Down
2 changes: 1 addition & 1 deletion WordList/WordCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class WordCell: UITableViewCell {
private let wordLabel: UILabel
private let uuidLabel: UILabel

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
wordLabel = UILabel()
uuidLabel = UILabel()

Expand Down
4 changes: 2 additions & 2 deletions WordList/WordListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class WordListViewController: UIViewController {
tableView.dataSource = self
tableView.delegate = self
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
tableView.rowHeight = UITableView.automaticDimension
}

override func viewDidLoad() {
Expand All @@ -45,7 +45,7 @@ class WordListViewController: UIViewController {
viewModel.userDidTapActionButton()
}

override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
super.motionEnded(motion, with: event)

if motion == .motionShake {
Expand Down
23 changes: 2 additions & 21 deletions WordList/WordListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class WordListViewModel {
completion(true)

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

func deleteWord(_ word: Word) -> Bool {
return update { words in
guard let index = words.index(where: { $0.identifier == word.identifier })
guard let index = words.firstIndex(where: { $0.identifier == word.identifier })
else { return false }
words.remove(at: index)
return true
Expand Down Expand Up @@ -118,22 +118,3 @@ final class WordListViewModel {
return result
}
}

private extension RangeReplaceableCollection {
func shuffled() -> Self {
var elements = self

for i in 0 ..< Int(elements.count) {
let distance = Int(arc4random() >> 1) % Int(elements.count)
let random = elements.index(elements.startIndex, offsetBy: IndexDistance(distance))
let index = elements.index(elements.startIndex, offsetBy: IndexDistance(i))
guard random != index else { continue }

let temp = elements[index]
elements.replaceSubrange(index ..< elements.index(after: index), with: CollectionOfOne(elements[random]))
elements.replaceSubrange(random ..< elements.index(after: random), with: CollectionOfOne(temp))
}

return elements
}
}

0 comments on commit d9e58fe

Please sign in to comment.