10 Commits

Author SHA1 Message Date
Ryan Nystrom 93921110b1 bump version 0.4.0 2018-10-21 19:21:20 -04:00
Ryan Nystrom ff7a0ee4a3 Merge pull request #40 from kukushi/master
Respect child view controller's status bar style
2018-10-21 15:39:34 -04:00
kukushi 33fbfa8667 Respect child view controller's status bar style 2018-10-21 22:09:39 +08:00
Ryan Nystrom a6956a5027 Merge pull request #39 from GitHawkApp/integral-frame
Snap to pixels when laying out container
2018-10-18 19:34:47 -04:00
Ryan Nystrom ea4129160a Snap to pixels when laying out container 2018-10-17 17:59:24 -04:00
Ryan Nystrom 02030429e2 Merge pull request #37 from batjo/master
Swift 4.2
2018-10-17 10:42:47 -04:00
Bart Jochems 40dffce6e7 Swift 4.2 2018-10-09 12:01:54 +02:00
Ryan Nystrom 5caf267cde Merge pull request #35 from Jauzee/master
Set iOS 9 as min deployment target
2018-09-14 06:51:47 -04:00
Abdurahim Jauzee f0c56680f2 Remove sign identity from the target 2018-09-14 06:59:58 +03:00
Abdurahim Jauzee 003a04a476 Set deployment target to iOS 9 2018-09-14 06:59:38 +03:00
9 changed files with 42 additions and 41 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'ContextMenu'
spec.version = '0.3.0'
spec.version = '0.4.0'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/GitHawkApp/ContextMenu'
spec.authors = { 'Ryan Nystrom' => 'rnystrom@whoisryannystrom.com' }
@@ -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, '10.0'
spec.swift_version = '4.0'
spec.swift_version = '4.2'
end
+16 -7
View File
@@ -197,7 +197,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0930;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Ryan Nystrom";
TargetAttributes = {
2971CE712054539900342296 = {
@@ -207,6 +207,7 @@
};
2991418320BC757000B63A3B = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
};
@@ -305,6 +306,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -312,6 +314,7 @@
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -365,6 +368,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -372,6 +376,7 @@
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -411,18 +416,20 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 523C4DWBTH;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ContextMenu/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.ContextMenu;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -434,17 +441,19 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 523C4DWBTH;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ContextMenu/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.ContextMenu;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -462,7 +471,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.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -480,7 +489,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.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -15,6 +15,10 @@ class ClippedContainerViewController: UIViewController {
private let options: ContextMenu.Options
private let containedViewController: UINavigationController
override var preferredStatusBarStyle: UIStatusBarStyle {
return viewController.preferredStatusBarStyle
}
init(options: ContextMenu.Options, viewController: UIViewController) {
self.viewController = viewController
self.options = options
@@ -36,7 +40,7 @@ class ClippedContainerViewController: UIViewController {
view.layer.shadowColor = UIColor.black.cgColor
view.backgroundColor = options.containerStyle.backgroundColor
if options.containerStyle.motionEffect && UIAccessibilityIsReduceMotionEnabled() == false {
if options.containerStyle.motionEffect && UIAccessibility.isReduceMotionEnabled == false {
let amount = 12
let tiltX = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis)
tiltX.minimumRelativeValue = -amount
@@ -68,9 +72,9 @@ class ClippedContainerViewController: UIViewController {
navigationBar.setBackgroundImage(image, for: .any, barMetrics: .default)
navigationBar.shadowImage = image
addChildViewController(containedViewController)
addChild(containedViewController)
view.addSubview(containedViewController.view)
containedViewController.didMove(toParentViewController: self)
containedViewController.didMove(toParent: self)
preferredContentSize = containedViewController.preferredContentSize
}
+2 -2
View File
@@ -23,13 +23,13 @@ extension ContextMenu {
let menuStyle: MenuStyle
/// Trigger haptic feedback when the menu is shown.
let hapticsStyle: UIImpactFeedbackStyle?
let hapticsStyle: UIImpactFeedbackGenerator.FeedbackStyle?
public init(
durations: AnimationDurations = AnimationDurations(),
containerStyle: ContainerStyle = ContainerStyle(),
menuStyle: MenuStyle = .default,
hapticsStyle: UIImpactFeedbackStyle? = nil
hapticsStyle: UIImpactFeedbackGenerator.FeedbackStyle? = nil
) {
self.durations = durations
self.containerStyle = containerStyle
+1
View File
@@ -52,6 +52,7 @@ public class ContextMenu: NSObject {
item.viewController.transitioningDelegate = self
item.viewController.modalPresentationStyle = .custom
item.viewController.modalPresentationCapturesStatusBarAppearance = true
sourceViewController.present(item.viewController, animated: true)
}
@@ -24,19 +24,19 @@ class ContextMenuPresentationController: UIPresentationController {
NotificationCenter.default.addObserver(
self,
selector: #selector(onKeyboard(notification:)),
name: .UIKeyboardWillShow,
name: UIResponder.keyboardWillShowNotification,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(onKeyboard(notification:)),
name: .UIKeyboardWillHide,
name: UIResponder.keyboardWillHideNotification,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(onKeyboard(notification:)),
name: .UIKeyboardWillChangeFrame,
name: UIResponder.keyboardWillChangeFrameNotification,
object: nil
)
}
@@ -59,6 +59,7 @@ class ContextMenuPresentationController: UIPresentationController {
override var frameOfPresentedViewInContainerView: CGRect {
guard let containerBounds = containerView?.bounds else { return .zero }
let size = presentedViewController.preferredContentSize
let frame: CGRect
if let corner = preferredSourceViewCorner {
let minPadding = item.options.containerStyle.edgePadding
let x = corner.point.x
@@ -67,20 +68,21 @@ class ContextMenuPresentationController: UIPresentationController {
let y = corner.point.y
+ corner.position.ySizeModifier * size.height
+ corner.position.yModifier * item.options.containerStyle.yPadding
return CGRect(
frame = CGRect(
x: max(minPadding, min(containerBounds.width - size.width - minPadding, x)),
y: max(minPadding, min(containerBounds.height - size.height - minPadding, y)),
width: size.width,
height: size.height
)
} else {
return CGRect(
frame = CGRect(
x: (containerBounds.width - size.width)/2,
y: (containerBounds.height - keyboardSpace - size.height)/2,
width: size.width,
height: size.height
)
}
return frame.integral
}
override func containerViewWillLayoutSubviews() {
@@ -162,8 +164,8 @@ class ContextMenuPresentationController: UIPresentationController {
}
@objc func onKeyboard(notification: Notification) {
guard let frame = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? CGRect,
let duration = notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? TimeInterval,
guard let frame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect,
let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval,
let containerView = self.containerView
else { return }
keyboardSpace = containerView.bounds.height - frame.minY
+3 -18
View File
@@ -106,7 +106,6 @@
2971CE9F205454BD00342296 /* Frameworks */,
2971CEA0205454BD00342296 /* Resources */,
27C1DE8FF747B6D110FAA1D7 /* [CP] Embed Pods Frameworks */,
823E736755195F61FFC5DDE6 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -129,6 +128,7 @@
TargetAttributes = {
2971CEA1205454BD00342296 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
};
@@ -201,21 +201,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
823E736755195F61FFC5DDE6 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -370,7 +355,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -386,7 +371,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
+1 -1
View File
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}