Compare commits
2 Commits
a11y-modal
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 846252cc15 | |||
| 6bae31e2be |
+2
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -13,7 +13,7 @@ class ClippedContainerViewController: UIViewController {
|
||||
let viewController: UIViewController
|
||||
|
||||
private let options: ContextMenu.Options
|
||||
private let containedViewController: ModalNavigationViewController
|
||||
private let containedViewController: UINavigationController
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
return viewController.preferredStatusBarStyle
|
||||
@@ -22,7 +22,7 @@ class ClippedContainerViewController: UIViewController {
|
||||
init(options: ContextMenu.Options, viewController: UIViewController) {
|
||||
self.viewController = viewController
|
||||
self.options = options
|
||||
self.containedViewController = ModalNavigationViewController(rootViewController: viewController)
|
||||
self.containedViewController = UINavigationController(rootViewController: viewController)
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
self.containedViewController.delegate = self
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import Foundation
|
||||
public extension ContextMenu {
|
||||
|
||||
/// Haptic Feedback types.
|
||||
public enum HapticFeedbackStyle: Int {
|
||||
enum HapticFeedbackStyle: Int {
|
||||
case light, medium, heavy
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,12 @@ class ContextMenuPresentationController: UIPresentationController {
|
||||
|
||||
override var frameOfPresentedViewInContainerView: CGRect {
|
||||
guard let containerBounds = containerView?.bounds else { return .zero }
|
||||
let size = presentedViewController.preferredContentSize
|
||||
var size = presentedViewController.preferredContentSize
|
||||
|
||||
// cap size to inset container bounds
|
||||
size.width = min(containerBounds.width - 2 * item.options.containerStyle.edgePadding, size.width)
|
||||
size.height = min(containerBounds.height - 2 * item.options.containerStyle.edgePadding, size.height)
|
||||
|
||||
let frame: CGRect
|
||||
if let corner = preferredSourceViewCorner {
|
||||
let minPadding = item.options.containerStyle.edgePadding
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// ModalNavigationViewController.swift
|
||||
// ContextMenu
|
||||
//
|
||||
// Created by Bas Broek on 01/04/2019.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ModalNavigationViewController: UINavigationController {
|
||||
override var accessibilityViewIsModal: Bool {
|
||||
get { return true }
|
||||
set {}
|
||||
}
|
||||
|
||||
override func accessibilityPerformEscape() -> Bool {
|
||||
dismiss(animated: UIAccessibility.isReduceMotionEnabled == false)
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user