Skip to content

Commit

Permalink
Merge pull request #3 from mateuszszklarek/swift4
Browse files Browse the repository at this point in the history
Migration to Swift 4.0
  • Loading branch information
mateuszszklarek authored Aug 23, 2017
2 parents 3f0cff9 + 23bc4b5 commit e139b22
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 41 deletions.
14 changes: 14 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ target 'SliderControllerTests' do
pod 'EarlGrey', '~> 1.11'
pod 'EarlGreySnapshots', '~> 0.0.2'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
case target.name
when 'EarlGreySnapshots', 'EarlGrey'
swift_version = '3.0'
else
swift_version = '4.0'
end
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = swift_version
end
end
end
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PODS:
- FBSnapshotTestCase/Core (2.1.4)
- FBSnapshotTestCase/SwiftSupport (2.1.4):
- FBSnapshotTestCase/Core
- SliderController (1.0.0)
- SliderController (1.0.1)

DEPENDENCIES:
- EarlGrey (~> 1.11)
Expand All @@ -23,8 +23,8 @@ SPEC CHECKSUMS:
EarlGrey: 7515b05c7f448374ad7ca2c454f3ea566fcb1a2f
EarlGreySnapshots: ce423ad576f1bae4315cd9ca313175d5d99be065
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
SliderController: 3e25166940c115c9b25be3aefbb6c92c2cfeb4d8
SliderController: 2bfe6557ef37653964ebd4996392174b8ba02135

PODFILE CHECKSUM: 0631ada32c08f94ae98532b28d792ad79c09a6ed
PODFILE CHECKSUM: f435f57544995ae8f8403d5afa9c35c744338669

COCOAPODS: 1.2.1
2 changes: 1 addition & 1 deletion SliderController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SliderController'
s.version = '1.0.1'
s.version = '1.0.2'
s.summary = 'Customized UISlider subclass managed by SliderController'
s.homepage = 'https://github.com/mateuszszklarek/SliderController.git'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
30 changes: 22 additions & 8 deletions SliderController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -307,20 +307,22 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Mateusz Szklarek";
TargetAttributes = {
4E3967561F2E57E800FA3B40 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
4EF2AD211F2E51C300666035 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0830;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
4EF2AD2A1F2E51C300666035 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
TestTargetID = 4E3967561F2E57E800FA3B40;
};
Expand Down Expand Up @@ -535,7 +537,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mateusz.szklarek.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -550,7 +552,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mateusz.szklarek.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -564,15 +566,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -618,15 +626,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -671,7 +685,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -691,7 +705,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -709,7 +723,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mateusz.szklarek.SliderControllerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
name = Debug;
Expand All @@ -728,7 +742,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mateusz.szklarek.SliderControllerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
language = ""
shouldUseLaunchSchemeArgsEnv = "NO"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
Expand All @@ -43,19 +44,37 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4EF2AD211F2E51C300666035"
BuildableName = "SliderController.framework"
BlueprintName = "SliderController"
BlueprintIdentifier = "4EF2AD2A1F2E51C300666035"
BuildableName = "SliderControllerTests.xctest"
BlueprintName = "SliderControllerTests"
ReferencedContainer = "container:SliderController.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "IMAGE_DIFF_DIR"
value = "$(SOURCE_ROOT)/Tests/FailureDiffs"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "FB_REFERENCE_IMAGE_DIR"
value = "$(SOURCE_ROOT)/Tests/ReferenceImages"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DYLD_INSERT_LIBRARIES"
value = "@executable_path/EarlGrey.framework/EarlGrey"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "NO"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -73,6 +74,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<string>1.0.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 21 additions & 21 deletions Tests/SliderControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,7 @@ class SliderControllerTests: XCTestCase {
application = nil
}

// MARK: - UI

func testMoveSliderToValue0_8() {
let targetValue: Float = 0.8

EarlGrey.select(elementWithMatcher: grey_kindOfClass(UISlider.self))
.perform(grey_moveSliderToValue(targetValue))
.assert(grey_sliderValueMatcher(grey_equalTo(targetValue)))
}

func testTapOnSliderAtMiddlePoint() {
let fullWidth = sut.view.frame.width
let targetPoint = CGPoint(x: fullWidth / 2, y: 0)

EarlGrey.select(elementWithMatcher: grey_kindOfClass(UISlider.self))
.perform(grey_tapAtPoint(targetPoint))
.assert(grey_sliderValueMatcher(grey_equalTo(0.5)))
}

// MARK: - Delegate functions
// MARK: - Delegate functions tests

func testMoveSliderToValue0_7ShouldInvokeDelegateMethodSliderValueDidChange() {
let targetValue: Float = 0.7
Expand Down Expand Up @@ -89,7 +70,26 @@ class SliderControllerTests: XCTestCase {
.assert(delegateSliderDidTapCall(atValue: 0.5))
}

// MARK: - UI + Snapshots
// MARK: - UI tests

func testMoveSliderToValue0_8() {
let targetValue: Float = 0.8

EarlGrey.select(elementWithMatcher: grey_kindOfClass(UISlider.self))
.perform(grey_moveSliderToValue(targetValue))
.assert(grey_sliderValueMatcher(grey_equalTo(targetValue)))
}

func testTapOnSliderAtMiddlePoint() {
let fullWidth = sut.view.frame.width
let targetPoint = CGPoint(x: fullWidth / 2, y: 0)

EarlGrey.select(elementWithMatcher: grey_kindOfClass(UISlider.self))
.perform(grey_tapAtPoint(targetPoint))
.assert(grey_sliderValueMatcher(grey_equalTo(0.5)))
}

// MARK: - UI + snapshots tests

func testMoveSliderToValue0_7_5ShouldLooksProperly() {
let targetValue: Float = 0.75
Expand Down

0 comments on commit e139b22

Please sign in to comment.