Skip to content

Commit 6bae31e

Browse files
batjornystrom
authored andcommitted
Swift 5 support (#51)
* Swift 5 support * Update tests and travis configuration * Update swift version in podspec
1 parent 03c33c4 commit 6bae31e

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language: swift
2-
osx_image: xcode9.3
2+
osx_image: xcode10.2
33
script:
4-
- xcodebuild clean -project ContextMenu.xcodeproj -scheme ContextMenu -destination "platform=iOS Simulator,name=iPhone X,OS=11.3" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -quiet
4+
- xcodebuild clean -project ContextMenu.xcodeproj -scheme ContextMenu -destination "platform=iOS Simulator,name=iPhone X,OS=12.2" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -quiet

ContextMenu.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Pod::Spec.new do |spec|
88
spec.source = { :git => 'https://github.com/GitHawkApp/ContextMenu.git', :tag => spec.version.to_s }
99
spec.source_files = 'ContextMenu/*.swift'
1010
spec.platform = :ios, '9.0'
11-
spec.swift_version = '4.2'
11+
spec.swift_version = '5.0'
1212
end

ContextMenu.xcodeproj/project.pbxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@
208208
TargetAttributes = {
209209
2971CE712054539900342296 = {
210210
CreatedOnToolsVersion = 9.2;
211-
LastSwiftMigration = 0920;
211+
LastSwiftMigration = 1020;
212212
ProvisioningStyle = Automatic;
213213
};
214214
2991418320BC757000B63A3B = {
215215
CreatedOnToolsVersion = 9.3;
216-
LastSwiftMigration = 1000;
216+
LastSwiftMigration = 1020;
217217
ProvisioningStyle = Automatic;
218218
};
219219
};
@@ -437,7 +437,7 @@
437437
PROVISIONING_PROFILE_SPECIFIER = "";
438438
SKIP_INSTALL = YES;
439439
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
440-
SWIFT_VERSION = 4.2;
440+
SWIFT_VERSION = 5.0;
441441
TARGETED_DEVICE_FAMILY = "1,2";
442442
};
443443
name = Debug;
@@ -461,7 +461,7 @@
461461
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
462462
PROVISIONING_PROFILE_SPECIFIER = "";
463463
SKIP_INSTALL = YES;
464-
SWIFT_VERSION = 4.2;
464+
SWIFT_VERSION = 5.0;
465465
TARGETED_DEVICE_FAMILY = "1,2";
466466
};
467467
name = Release;
@@ -479,7 +479,7 @@
479479
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
480480
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.ContextMenuTests;
481481
PRODUCT_NAME = "$(TARGET_NAME)";
482-
SWIFT_VERSION = 4.2;
482+
SWIFT_VERSION = 5.0;
483483
TARGETED_DEVICE_FAMILY = "1,2";
484484
};
485485
name = Debug;
@@ -497,7 +497,7 @@
497497
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
498498
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.ContextMenuTests;
499499
PRODUCT_NAME = "$(TARGET_NAME)";
500-
SWIFT_VERSION = 4.2;
500+
SWIFT_VERSION = 5.0;
501501
TARGETED_DEVICE_FAMILY = "1,2";
502502
};
503503
name = Release;

ContextMenu/ContextMenu+HapticFeedbackStyle.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
public extension ContextMenu {
1111

1212
/// Haptic Feedback types.
13-
public enum HapticFeedbackStyle: Int {
13+
enum HapticFeedbackStyle: Int {
1414
case light, medium, heavy
1515
}
1616

ContextMenuTests/CGRect_AreaTests.swift

+11-10
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ import XCTest
1212
class CGRect_AreaTests: XCTestCase {
1313

1414
let rect = CGRect(x: 0, y: 0, width: 100, height: 100)
15-
15+
1616
func test_whenCornersHavePadding() {
17-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 10, y: 10), position: .topLeft)), 100)
18-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 90, y: 10), position: .topRight)), 100)
19-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 90, y: 90), position: .bottomRight)), 100)
20-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 10, y: 90), position: .bottomLeft)), 100)
17+
18+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 10, y: 10, width: 0, height: 0), position: .topLeft)), 100)
19+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 90, y: 10, width: 0, height: 0), position: .topRight)), 100)
20+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 90, y: 90, width: 0, height: 0), position: .bottomRight)), 100)
21+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 10, y: 90, width: 0, height: 0), position: .bottomLeft)), 100)
2122
}
2223

2324
func test_whenCornersHaveNoPadding() {
24-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 0, y: 0), position: .topLeft)), 0)
25-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 100, y: 0), position: .topRight)), 0)
26-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 100, y: 100), position: .bottomRight)), 0)
27-
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 00, y: 100), position: .bottomLeft)), 0)
25+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 0, y: 0, width: rect.width, height: rect.height), position: .topLeft)), 0)
26+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 100, y: 0, width: rect.width, height: rect.height), position: .topRight)), 0)
27+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 100, y: 100, width: rect.width, height: rect.height), position: .bottomRight)), 0)
28+
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 0, y: 100, width: rect.width, height: rect.height), position: .bottomLeft)), 0)
2829
}
29-
30+
3031
}

0 commit comments

Comments
 (0)