Compare commits
6 Commits
0.1.0
...
reduce-motion
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e94b10a95 | |||
| 93e12a4b16 | |||
| 8572bf3969 | |||
| 33b58dbbde | |||
| bf7cd281f7 | |||
| 998ecaca42 |
@@ -22,6 +22,7 @@
|
||||
2971CE96205453D900342296 /* SourceViewCorner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2971CE88205453D900342296 /* SourceViewCorner.swift */; };
|
||||
2971CE97205453D900342296 /* ContextMenuPresenting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2971CE89205453D900342296 /* ContextMenuPresenting.swift */; };
|
||||
2971CE98205453D900342296 /* CGRect+Area.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2971CE8A205453D900342296 /* CGRect+Area.swift */; };
|
||||
DE5D838B2055D72A0069A81D /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5D838A2055D72A0069A81D /* UIViewController+Extensions.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -42,6 +43,7 @@
|
||||
2971CE88205453D900342296 /* SourceViewCorner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceViewCorner.swift; sourceTree = "<group>"; };
|
||||
2971CE89205453D900342296 /* ContextMenuPresenting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextMenuPresenting.swift; sourceTree = "<group>"; };
|
||||
2971CE8A205453D900342296 /* CGRect+Area.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CGRect+Area.swift"; sourceTree = "<group>"; };
|
||||
DE5D838A2055D72A0069A81D /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extensions.swift"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -90,6 +92,7 @@
|
||||
2971CE89205453D900342296 /* ContextMenuPresenting.swift */,
|
||||
2971CE762054539900342296 /* Info.plist */,
|
||||
2971CE88205453D900342296 /* SourceViewCorner.swift */,
|
||||
DE5D838A2055D72A0069A81D /* UIViewController+Extensions.swift */,
|
||||
);
|
||||
path = ContextMenu;
|
||||
sourceTree = "<group>";
|
||||
@@ -181,6 +184,7 @@
|
||||
2971CE90205453D900342296 /* ContextMenuDismissing.swift in Sources */,
|
||||
2971CE94205453D900342296 /* ContextMenu+MenuStyle.swift in Sources */,
|
||||
2971CE8E205453D900342296 /* ContextMenu+ContainerStyle.swift in Sources */,
|
||||
DE5D838B2055D72A0069A81D /* UIViewController+Extensions.swift in Sources */,
|
||||
2971CE95205453D900342296 /* ClippedContainerViewController.swift in Sources */,
|
||||
2971CE96205453D900342296 /* SourceViewCorner.swift in Sources */,
|
||||
2971CE8F205453D900342296 /* ContextMenu+Item.swift in Sources */,
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0920"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2971CE712054539900342296"
|
||||
BuildableName = "ContextMenu.framework"
|
||||
BlueprintName = "ContextMenu"
|
||||
ReferencedContainer = "container:ContextMenu.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2971CE712054539900342296"
|
||||
BuildableName = "ContextMenu.framework"
|
||||
BlueprintName = "ContextMenu"
|
||||
ReferencedContainer = "container:ContextMenu.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2971CE712054539900342296"
|
||||
BuildableName = "ContextMenu.framework"
|
||||
BlueprintName = "ContextMenu"
|
||||
ReferencedContainer = "container:ContextMenu.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -32,7 +32,7 @@ class ClippedContainerViewController: UIViewController {
|
||||
view.layer.shadowColor = UIColor.black.cgColor
|
||||
view.backgroundColor = options.containerStyle.backgroundColor
|
||||
|
||||
if options.containerStyle.motionEffect {
|
||||
if options.containerStyle.motionEffect && UIAccessibilityIsReduceMotionEnabled() == false {
|
||||
let amount = 12
|
||||
let tiltX = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis)
|
||||
tiltX.minimumRelativeValue = -amount
|
||||
|
||||
@@ -38,6 +38,7 @@ extension ContextMenu {
|
||||
public let overlayColor: UIColor
|
||||
|
||||
/// A flag indicating if device gyro effects should be applied.
|
||||
/// If the user has enabled Reduce Motion in Settings, this will be ignored.
|
||||
public let motionEffect: Bool
|
||||
|
||||
public init(
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// UIViewController+Extensions.swift
|
||||
// ContextMenu
|
||||
//
|
||||
// Created by Wes Wickwire on 3/11/18.
|
||||
// Copyright © 2018 Ryan Nystrom. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
|
||||
extension UIViewController {
|
||||
|
||||
/// Show a context menu with given options.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - viewController: A content view controller to use inside the menu.
|
||||
/// - options: Display and behavior options for a menu.
|
||||
/// - sourceView: A source view for menu context. If nil, menu displays from the center of the screen.
|
||||
public func showContextualMenu(
|
||||
_ viewController: UIViewController,
|
||||
options: ContextMenu.Options = ContextMenu.Options(),
|
||||
sourceView: UIView? = nil
|
||||
) {
|
||||
|
||||
ContextMenu.shared.show(
|
||||
sourceViewController: self,
|
||||
viewController: viewController,
|
||||
options: options,
|
||||
sourceView: sourceView
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user