diff --git a/CHANGELOG.md b/CHANGELOG.md index dded8f6..640a1e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,16 @@ # Change Log -All notable changes to the library will be documented in this file. +All notable changes of the library will be documented in this file. -## [Unreleased] +## 2.1 - [2017-10-23] +### Added +- Swift 4 support +- Code refactoring +- Check if menu is opened before a transition + +### Fixed +- Small UI fix of Sample, associated with iOS 11 + +## 2.0 - [2017-06-07] ### Added - UITabBarController and UINavigationController menu items support - Rotation support @@ -18,7 +27,7 @@ All notable changes to the library will be documented in this file. **Migration notes** -- To mark UIViewController as item of SideMenu you should adopt `SideMenuItemContent` protocol instead of inheritance. +- To mark UIViewController as item of SideMenu you should adopt `SideMenuItemContent` protocol instead of inheritance from `MenuItemContentViewController`. To show menu you should call `showSideMenu()` method from this protocol. ```swift import InteractiveSideMenu @@ -30,6 +39,8 @@ class KittyViewController: UIViewController, SideMenuItemContent { } } ``` +Please, keep in mind, that now you are manipulating with `UIViewControllers` instead of `MenuItemContentViewControllers` in your `HostViewController` class. + - To customize animation you should now update ```transitionOptions``` property in ```MenuContainerViewColtroller``` class. ```swift override func viewDidLoad() { @@ -57,5 +68,6 @@ override func viewWillTransition(to size: CGSize, with coordinator: UIViewContro - Sample demonstrating using SideMenu library - README file -[Unreleased]: https://github.com/handsomecode/InteractiveSideMenu/compare/master...feature/nav_and_tab_controllers_support +[2017-10-23]: https://github.com/handsomecode/InteractiveSideMenu/compare/2.0...2.1 +[2017-06-07]: https://github.com/handsomecode/InteractiveSideMenu/compare/1.0...2.0 [Issue #17]: https://github.com/handsomecode/InteractiveSideMenu/issues/17 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..de2dd79 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mobile@handsome.is. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..85eb992 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,97 @@ +# Contributing to InteractiveSideMenu + +:+1: First of all, big thanks for your desire to contribute in this project :+1: + +## How to contribute + +The easiest way to contribute is to *report a bug* or *propose a new feature* using [GitHub Issues](https://github.com/handsomecode/InteractiveSideMenu/issues). +Also, feel free to send your suggestions concerning any library issues, documentation and README typos, [Sample](./Sample) improvements, or any other enhancements. **We really appreciate your participation!** + +### How to ask a question + +Before asking a question, please look through the [README](./README.md) and [Sample application](./Sample) or take a look into [already asked GitHub Issues](https://github.com/handsomecode/InteractiveSideMenu/issues) (even closed). If you still haven't found an answer, feel free to [open an issue](https://github.com/handsomecode/InteractiveSideMenu/issues/new) and ask us your question and mark it with the prepared `question` label. + +### How to report a bug + +The standard way to report a bug is [GitHub Issues](https://github.com/handsomecode/InteractiveSideMenu/issues). + +Explain the problem and include additional details to help maintainers reproduce the problem: + +- **Use a clear and descriptive title** for the issue to identify the problem. +- **Describe the exact steps to reproduce the problem** in as many details as possible. +- **Provide specific examples** to demonstrate these steps. Include links to files or GitHub projects, or copy/paste snippets. If you're providing snippets in the issue, use Markdown code blocks. +- **Describe the behavior you observed** after following these steps and point out what exactly is the problem with that behavior. +- **Explain the behavior you expected** to see instead and why. +- **Include screenshots and animated GIFs** which show you following the described steps and clearly demonstrate the problem. +- **If you're reporting a library crash**, include a crash report with a stack trace. + +Include details about your configuration and environment: + +- **Which version of InteractiveSideMenu** are you using? +- Do you test on the **Simulator** or a **Real device**? +- **iOS version** that you test with. +- **Xcode version** if it could be helpful in your case. + +### How to request an enhancement + +**Enhancements** are features that you might like to suggest to a project, but aren't necessarily bugs/problems with the existing code. There is *a label* for enhancements in [Github's Issues](https://github.com/handsomecode/InteractiveSideMenu/issues), so you can tag issues as `enhancement`, and thereby allow us to prioritize issues/bugs reported to the project. + + +### How to tell us about your application + +If you are using **InteractiveSideMenu** in your project that is successfully published to AppStore, [send the link](https://github.com/handsomecode/InteractiveSideMenu/issues/new) to us and we'll add you to the list of applications that use the library. + + +### How to submit changes + +When contributing to this repository, please, first discuss the change you wish to make via [issue](https://github.com/handsomecode/InteractiveSideMenu/issues/new). +The preferred workflow for contributing to InteractiveSideMenu is to fork the [main repository](https://github.com/handsomecode/InteractiveSideMenu) on +GitHub, clone, and develop on a branch. + +**Steps:** + +1. Fork the [project repository](https://github.com/handsomecode/InteractiveSideMenu) + by clicking on the 'Fork' button near the top right of the page. This creates + a copy of the code under your GitHub user account. For more details on + how to fork a repository see [this guide](https://help.github.com/articles/fork-a-repo/). + +2. Clone your fork of the *InteractiveSideMenu* repo from your GitHub account to your local disk + + ```bash + $ git clone git@github.com:YourLogin/InteractiveSideMenu.git + $ cd InteractiveSideMenu + ``` + +3. Checkout to `develop` branch, and create a ``feature`` branch to hold your development changes + + ```bash + $ git checkout develop + $ git checkout -b feature/my_updates + ``` + + Always use a ``feature`` branch. It's good practice to add updates to the main branches. + +4. Develop the feature on your feature branch. Add changed files using ``git add`` and then ``git commit`` files + + ```bash + $ git add modified_files + $ git commit + ``` + + to record your changes in Git, then push the changes to your GitHub account with + + ```bash + $ git push -u origin feature/my_updates + ``` + +5. Add your updates to [Sample](./Sample) as well. Also, don't forget to update [README](./README.md) and [CHANGELOG](./CHANGELOG.md) with your changes. + +6. Follow [these instructions](https://help.github.com/articles/creating-a-pull-request-from-a-fork) +to create a pull request from your fork. This will send an email to the committers. + +(If any of the above seems like magic to you, please look up the +[Git documentation](https://git-scm.com/documentation) on the web, or ask a friend or another contributor for help) + +## Code of Conduct + +This project is governed by the [CODE OF CONDUCT](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please, report unacceptable behavior to mobile@handsome.is. diff --git a/InteractiveSideMenu.podspec b/InteractiveSideMenu.podspec index 20336a7..165e01c 100644 --- a/InteractiveSideMenu.podspec +++ b/InteractiveSideMenu.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "InteractiveSideMenu" - s.version = "2.0" + s.version = "2.1" s.summary = "Interactive Side Menu in Swift" s.homepage = "https://github.com/handsomecode/InteractiveSideMenu" s.license = "Apache 2.0 license" diff --git a/InteractiveSideMenu.xcodeproj/project.pbxproj b/InteractiveSideMenu.xcodeproj/project.pbxproj index 25be181..12327eb 100644 --- a/InteractiveSideMenu.xcodeproj/project.pbxproj +++ b/InteractiveSideMenu.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 84E2E6751F15401000E5FF37 /* Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E2E6741F15401000E5FF37 /* Options.swift */; }; + 84E2E6771F15406600E5FF37 /* MenuTransitioningDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E2E6761F15406600E5FF37 /* MenuTransitioningDelegate.swift */; }; 881EF0921E3101130035DEB4 /* InteractiveSideMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 881EF0901E3101130035DEB4 /* InteractiveSideMenu.h */; settings = {ATTRIBUTES = (Public, ); }; }; 881EF0971E3101B80035DEB4 /* MenuAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881EF0931E3101B80035DEB4 /* MenuAnimator.swift */; }; 881EF0981E3101B80035DEB4 /* MenuContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881EF0941E3101B80035DEB4 /* MenuContainerViewController.swift */; }; @@ -15,6 +17,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 84E2E6741F15401000E5FF37 /* Options.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Options.swift; sourceTree = ""; }; + 84E2E6761F15406600E5FF37 /* MenuTransitioningDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuTransitioningDelegate.swift; sourceTree = ""; }; 881EF0831E30FFE40035DEB4 /* InteractiveSideMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = InteractiveSideMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 881EF08F1E3101130035DEB4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 881EF0901E3101130035DEB4 /* InteractiveSideMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InteractiveSideMenu.h; sourceTree = ""; }; @@ -54,6 +58,8 @@ 881EF08E1E3101130035DEB4 /* Sources */ = { isa = PBXGroup; children = ( + 84E2E6741F15401000E5FF37 /* Options.swift */, + 84E2E6761F15406600E5FF37 /* MenuTransitioningDelegate.swift */, 881EF0931E3101B80035DEB4 /* MenuAnimator.swift */, 881EF0941E3101B80035DEB4 /* MenuContainerViewController.swift */, 881EF0951E3101B80035DEB4 /* MenuItemContentViewController.swift */, @@ -145,8 +151,10 @@ buildActionMask = 2147483647; files = ( 881EF0971E3101B80035DEB4 /* MenuAnimator.swift in Sources */, + 84E2E6771F15406600E5FF37 /* MenuTransitioningDelegate.swift in Sources */, 881EF0981E3101B80035DEB4 /* MenuContainerViewController.swift in Sources */, 881EF0991E3101B80035DEB4 /* MenuItemContentViewController.swift in Sources */, + 84E2E6751F15401000E5FF37 /* Options.swift in Sources */, 881EF09A1E3101B80035DEB4 /* MenuViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/README.md b/README.md index 7b13e24..9a2e08d 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,16 @@ It supports following customization: All these parameters could vary for different orientations. +## Communication + +- If you **need help or found a bug**, please, open an issue. +- If you **have a feature request**, open an issue. +- If you **are ready to contribute**, submit a pull request. +- If you **like Interactive Side Menu**, please, give it a star. +- If you **use Interactive Side Menu in your application published to AppStore**, [send us a link](https://github.com/handsomecode/InteractiveSideMenu/issues/new) and we'll create the list with applications used our library. + +You can find more details into [CONTRIBUTING](./CONTRIBUTING.md) file. + # Installation ## CocoaPods @@ -24,6 +34,7 @@ To install it through [CocoaPods](https://cocoapods.org/), add the following lin ``` pod 'InteractiveSideMenu' ``` +Please, don't forget to run `pod update` command to update your local specs repository during migration from one version to another. ## Carthage To install it through [Carthage](https://github.com/Carthage/Carthage), add the following line to your Cartfile: @@ -40,6 +51,7 @@ To implement your side menu you should create subclasses of basic View Controlle Also, ensure that every menu item ViewController adopts relevant protocol. - ```SideMenuItemContent``` is a ViewController's protocol for data that corresponds menu item +## HostViewController implementation To setup your side menu you need to do three things: - Provide implementation of base ```MenuViewController``` and assing it to ```menuViewController``` property - Provide implementation of menu content and assing array of content controllers to ```contentViewControllers``` property @@ -66,6 +78,7 @@ class HostViewController: MenuContainerViewController { } ``` +## Items content To show menu, call ```showSideMenu()``` method from `SideMenuItemContent` protocol. ```swift import InteractiveSideMenu @@ -80,13 +93,32 @@ class KittyViewController: UIViewController, SideMenuItemContent { To change content view, choose desired content controller and hide menu. ```swift - let index = 2 // second menu item + let index = 2 // Second menu item guard let menuContainerViewController = self.menuContainerViewController else { return } let contentController = menuContainerViewController.contentViewControllers[index] menuContainerViewController.selectContentViewController(contentController) - menuContainerViewController.hideMenu() + menuContainerViewController.hideSideMenu() ``` + +### TabBar and Navigation controllers + +To use menu with **TabBar** or **NavigationController**, ensure that you indicate UITabBarController or UINavigationController as item content directly, not any corresponding ViewControllers. +```swift +class NavigationViewController: UINavigationController, SideMenuItemContent { +} +class InnerViewController: UIViewController { + + @IBAction func openMenu(_ sender: Any) { + if let navigationViewController = self.navigationController as? SideMenuItemContent { + navigationViewController.showSideMenu() + } + } +} +``` +Please, find UITabBarController implementation details in [Sample](./Sample). + +## Animation Customization To customize animation for menu opening or closing, update ```transitionOptions``` property that is available in ```MenuContainerViewColtroller``` class. Initial setup could be done, for example, on controller's ```viewDidLoad()```. ```swift override func viewDidLoad() { @@ -110,7 +142,11 @@ override func viewWillTransition(to size: CGSize, with coordinator: UIViewContro Transition options could be used to set different parameters for Compact and Regular sizes as well. Implement ViewController's ```traitCollectionDidChange(_: )``` method to add these settings. - See [Sample](./Sample) for more details. + Use [Sample](./Sample) to see implementation details and [CHANGELOG](./CHANGELOG.md) to get more information about updating library from v1.0 to v2.0. + +# Known Issues +There is [an issue](https://github.com/handsomecode/InteractiveSideMenu/issues/53) associated with scaling of NavigationBar in iOS 11. Status bar background is hidden during side menu closing if `contentScale < 1`. It’s supposed to be *iOS 11* Navigation Bar issue that's been reported to Apple. + # Requirements - iOS 8.0+ diff --git a/Sample/Sample/AppDelegate.swift b/Sample/Sample/AppDelegate.swift index f1f0392..9ab525b 100644 --- a/Sample/Sample/AppDelegate.swift +++ b/Sample/Sample/AppDelegate.swift @@ -53,4 +53,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } - diff --git a/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json index d98c3c4..c0b8464 100644 --- a/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -143,6 +143,11 @@ "idiom" : "ipad", "filename" : "Icon-App-83.5x83.5@2x.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Sample/Sample/Base.lproj/Main.storyboard b/Sample/Sample/Base.lproj/Main.storyboard index 44ba7b6..5ad94b9 100644 --- a/Sample/Sample/Base.lproj/Main.storyboard +++ b/Sample/Sample/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -131,9 +131,12 @@ - - + + + + +