Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add menu viewcontroller safearea support #148

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 50 additions & 30 deletions Example/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PackageDescription
let package = Package(
name: "SideMenu",
platforms: [
.iOS(.v9)
.iOS(.v11)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# ![](https://github.com/kukushi/SideMenu/blob/develop/Images/Logo.png?raw=true)

[![Version](https://img.shields.io/cocoapods/v/SideMenuSwift.svg?style=flat-square)](http://cocoapods.org/pods/SideMenuSwift)
![Swift5](https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat%22)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage)
Expand All @@ -26,12 +24,12 @@ Besides all the features a *Side Menu* should have, it supports:

Menu Position / Status Menu Behavior

| Above + None | Below + Slide |
| --- | --- |
| Above + None | Below + Slide |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| ![](https://raw.githubusercontent.com/kukushi/SideMenu/master/Images/Above%2BNone.gif) | ![](https://raw.githubusercontent.com/kukushi/SideMenu/master/Images/Below%2BSlide.gif) |

| SideBySide + Fade | SideBySide + HideOnMenu |
| --- | --- |
| SideBySide + Fade | SideBySide + HideOnMenu |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| ![](https://raw.githubusercontent.com/kukushi/SideMenu/master/Images/SideBySide%2BFade.gif) | ![](https://raw.githubusercontent.com/kukushi/SideMenu/master/Images/SideBySide%2BHideOnMenu.gif) |

We call the left/right view controller as the **menu** view controller, the central view controller as **content** view controller.
Expand All @@ -51,6 +49,7 @@ To install `SideMenu` with [CocoaPods](http://cocoapods.org/), add the below lin
pod 'SideMenuSwift'
# Note it's NOT 'SideMenu'
```

### Carthage

To install `SideMenu` with [Carthage](https://github.com/Carthage/Carthage), add the below line in your `Cartfile`:
Expand All @@ -76,15 +75,15 @@ github "kukushi/SideMenu" "master"
To set up `SideMenu` in storyboard:
</summary>


1. Open the view controller's *Identity inspector*. Change its **Class** to `SideMenuController` and **Module** to `SideMenuSwift`.
2. Set up the menu view controller and the initial content view controller in your Storyboard. Add a **Custom** segue from the `SideMenuController` to each of them.
- Change the menu segue's identifier to `SideMenu.Menu`, **Class** to `SideMenuSegue` and **Module** to `SideMenuSwift`.
- Change the content segue's identifier to `SideMenu.Content`, **Class** to `SideMenuSegue` and **Module** to `SideMenuSwift`.
4. (Optional) If you want to use custom segue identifier:
- Change the menu segue's identifier to `SideMenu.Menu`, **Class** to `SideMenuSegue` and **Module** to `SideMenuSwift`.
- Change the content segue's identifier to `SideMenu.Content`, **Class** to `SideMenuSegue` and **Module** to `SideMenuSwift`.
3. (Optional) If you want to use custom segue identifier:
- Open the `SideMenuController`'s *Attribute inspector*.
- In the **Side Menu Controller** section, modify the *Content SegueID/Menu SegueID* to the desired value and change the corresponding segue's identifier.
5. It's done. Check [this screenshot](https://github.com/kukushi/SideMenu/blob/develop/Images/StoryboardSample.png?raw=true) a for clear view.
4. It's done. Check [this screenshot](https://github.com/kukushi/SideMenu/blob/develop/Images/StoryboardSample.png?raw=true) a for clear view.

</details>

### Programmatically
Expand All @@ -109,14 +108,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let menuViewController = ...

window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = SideMenuController(contentViewController: contentViewController,
window?.rootViewController = SideMenuController(contentViewController: contentViewController,
menuViewController: menuViewController)

window?.makeKeyAndVisible()
return true
}
}
```

</details>

Use the `sideMenuController` method which provided in `UIViewController`'s extension to get the parent `SideMenuController`:
Expand All @@ -143,7 +143,7 @@ SideMenuController.preferences.basic.shouldRespectLanguageDirection = true

### Caching the Content

One of the coolest features of `SideMenu` is caching.
One of the coolest features of `SideMenu` is caching.

```swift
// Cache the view controllers somewhere in your code
Expand All @@ -170,7 +170,7 @@ sideMenuController?.cache(viewControllerGenerator: { self.storyboard?.instantiat
## Requirements

- Xcode 10 or later
- iOS 9.0 or later
- iOS 11.0 or later

## License

Expand Down
20 changes: 10 additions & 10 deletions SideMenu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,9 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = U6N93T3598;
DEVELOPMENT_TEAM = 34PEP7YC95;
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -570,9 +570,9 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = U6N93T3598;
DEVELOPMENT_TEAM = 34PEP7YC95;
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -636,7 +636,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -694,7 +694,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -714,13 +714,13 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = U6N93T3598;
DEVELOPMENT_TEAM = 34PEP7YC95;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Sources/SideMenu/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -742,13 +742,13 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = U6N93T3598;
DEVELOPMENT_TEAM = 34PEP7YC95;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Sources/SideMenu/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
9 changes: 4 additions & 5 deletions SideMenuSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ Pod::Spec.new do |s|
s.name = "SideMenuSwift"
s.version = "2.0.10"
s.summary = "An interactive iOS side menu with rich features."

s.description = <<-DESC
SideMenuSwift is an iOS container view controller written in Swift. Its easy-to-use and supports both storyboard and code. It provides several ways to reveal the menu and animate the status bar.
DESC

s.homepage = "https://github.com/kukushi/SideMenu"
s.license = "MIT"
s.author = { "kukushi" => "" }
s.platform = :ios, "9.0"
s.platform = :ios, "11.0"
s.source = { :git => "https://github.com/kukushi/SideMenu.git", :tag => s.version }
s.source_files = "Sources/SideMenu/*.{h,m,swift}"
s.swift_version = "5.0"
s.requires_arc = true

end

Loading