Skip to content

Commit

Permalink
Swift 5 support (#51)
Browse files Browse the repository at this point in the history
* Swift 5 support

* Update tests and travis configuration

* Update swift version in podspec
  • Loading branch information
batjo authored and rnystrom committed Jun 3, 2019
1 parent 03c33c4 commit 6bae31e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: swift
osx_image: xcode9.3
osx_image: xcode10.2
script:
- 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
- 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
2 changes: 1 addition & 1 deletion ContextMenu.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Pod::Spec.new do |spec|
spec.source = { :git => 'https://github.com/GitHawkApp/ContextMenu.git', :tag => spec.version.to_s }
spec.source_files = 'ContextMenu/*.swift'
spec.platform = :ios, '9.0'
spec.swift_version = '4.2'
spec.swift_version = '5.0'
end
12 changes: 6 additions & 6 deletions ContextMenu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@
TargetAttributes = {
2971CE712054539900342296 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
2991418320BC757000B63A3B = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -437,7 +437,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -461,7 +461,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -479,7 +479,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.ContextMenuTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -497,7 +497,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.ContextMenuTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion ContextMenu/ContextMenu+HapticFeedbackStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
public extension ContextMenu {

/// Haptic Feedback types.
public enum HapticFeedbackStyle: Int {
enum HapticFeedbackStyle: Int {
case light, medium, heavy
}

Expand Down
21 changes: 11 additions & 10 deletions ContextMenuTests/CGRect_AreaTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ import XCTest
class CGRect_AreaTests: XCTestCase {

let rect = CGRect(x: 0, y: 0, width: 100, height: 100)

func test_whenCornersHavePadding() {
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 10, y: 10), position: .topLeft)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 90, y: 10), position: .topRight)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 90, y: 90), position: .bottomRight)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 10, y: 90), position: .bottomLeft)), 100)

XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 10, y: 10, width: 0, height: 0), position: .topLeft)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 90, y: 10, width: 0, height: 0), position: .topRight)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 90, y: 90, width: 0, height: 0), position: .bottomRight)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 10, y: 90, width: 0, height: 0), position: .bottomLeft)), 100)
}

func test_whenCornersHaveNoPadding() {
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 0, y: 0), position: .topLeft)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 100, y: 0), position: .topRight)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 100, y: 100), position: .bottomRight)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(point: CGPoint(x: 00, y: 100), position: .bottomLeft)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 0, y: 0, width: rect.width, height: rect.height), position: .topLeft)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 100, y: 0, width: rect.width, height: rect.height), position: .topRight)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 100, y: 100, width: rect.width, height: rect.height), position: .bottomRight)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 0, y: 100, width: rect.width, height: rect.height), position: .bottomLeft)), 0)
}

}

0 comments on commit 6bae31e

Please sign in to comment.