Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
37318e8
Fix horizontal images behavior during closing menu animation in sample
Apr 18, 2017
a959a1a
Small renaming
Apr 18, 2017
dfeb413
Add tabbar controller and navigation controller support, update sample
Apr 25, 2017
6532429
Update README.md
okonor Apr 25, 2017
6ffa1b8
Add Changelog file
Apr 27, 2017
efd622f
Update CHANGELOG.md
Apr 27, 2017
eec9dcf
Merge branch 'feature/nav_and_tab_controllers_support' into develop
Apr 27, 2017
f78d554
Fix methods naming, fix constraints in sample
May 2, 2017
02d379f
Add rotation support
May 15, 2017
2eec604
Add options to control landscape animation settings
May 17, 2017
63c9a47
Update changelog
May 17, 2017
991dea0
Remove extra force-unwrapping properties, remove unused code
May 17, 2017
72cef8c
Fix reviewers notes
May 18, 2017
4216295
Replace transition options builder with struct initialization
May 19, 2017
206406a
Add possibility to update transition options
May 22, 2017
10b8660
Remove unnecessary options callback, refactor code
May 23, 2017
340751e
Update the way to set custom options: from method to the property
May 23, 2017
20db6ff
Merge feature branch: rotation_support
May 23, 2017
90ec42e
Change some implicitly unwrapped optionals to usual optionals
May 23, 2017
eb9f688
Refactor code
May 25, 2017
fe8cdf7
Fix installing on device issue
May 30, 2017
c131769
Add placeholder color for nil snapshot, refactor fatal messages
May 31, 2017
ca2926d
Update images in Sample
Jun 1, 2017
8728435
Merge enhancement branch: feature/refactoring
Jun 1, 2017
1c2c793
Add public methods documentation
Jun 1, 2017
1994ff1
Update sample icon, fix minor open menu button issue in sample
Jun 2, 2017
fa5f2d6
Fix bug when user uses interactive transitioning first
Jun 2, 2017
99c1e46
Update changelog info
Jun 2, 2017
ed2045d
Fix documentation notes
Jun 5, 2017
81abfe6
Merge branch 'develop' into feature/documentation
Jun 5, 2017
1b24388
Merge pull request from handsomecode/feature/documentation
Jun 5, 2017
bc2039d
Fix customization spring animation parameters issue
Jun 5, 2017
92beb7e
Update changelog file
Jun 5, 2017
d5a7125
Refactor sample, add documentation in code
Jun 6, 2017
ac3177e
Fix status bar in landscape issue
Jun 6, 2017
9f6f04e
Update CHANGELOG.md
Jun 6, 2017
4abf532
Update README.md
Jun 6, 2017
7d71860
Merge feature branch: improving_sample
Jun 6, 2017
23af07d
Update README.md
Jun 7, 2017
53a67bd
Update InteractiveSideMenu.podspec
Jun 7, 2017
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
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Change Log
All notable changes to the library will be documented in this file.

## [Unreleased]
### Added
- UITabBarController and UINavigationController menu items support
- Rotation support
- Public methods documentation in code
- CHANGELOG file

### Changed
- Renamed `showMenu()`/`hideMenu()` methods to `showSideMenu()`/`hideSideMenu()`
- Reworked [Sample](./Sample)

### Fixed
- Customization of spring animation parameters: [Issue #17]
- Displaying horizontal images in [Sample](./Sample)

**Migration notes**

- To mark UIViewController as item of SideMenu you should adopt `SideMenuItemContent` protocol instead of inheritance.
To show menu you should call `showSideMenu()` method from this protocol.
```swift
import InteractiveSideMenu

class KittyViewController: UIViewController, SideMenuItemContent {

@IBAction func openMenu(_ sender: UIButton) {
showSideMenu()
}
}
```
- To customize animation you should now update ```transitionOptions``` property in ```MenuContainerViewColtroller``` class.
```swift
override func viewDidLoad() {
super.viewDidLoad()
let screenSize: CGRect = UIScreen.main.bounds
self.transitionOptions = TransitionOptions(duration: 0.4, visibleContentWidth: screenSize.width / 6)
...
}
```

- Now you have possibility to update customization settings using ```viewWillTransition(to:with:)``` mehod.
```swift
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
var options = TransitionOptions()
options.duration = size.width < size.height ? 0.4 : 0.6
options.visibleContentWidth = size.width / 6
self.transitionOptions = options
}
```

## 1.0 - 2017-01-23
### Added
- Left SideMenu with possibility to customize menu animation and content
- Sample demonstrating using SideMenu library
- README file

[Unreleased]: https://github.com/handsomecode/InteractiveSideMenu/compare/master...feature/nav_and_tab_controllers_support
[Issue #17]: https://github.com/handsomecode/InteractiveSideMenu/issues/17
4 changes: 2 additions & 2 deletions InteractiveSideMenu.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "InteractiveSideMenu"
s.version = "1.0"
s.version = "2.0"
s.summary = "Interactive Side Menu in Swift"
s.homepage = "https://github.com/handsomecode/InteractiveSideMenu"
s.license = "Apache 2.0 license"
Expand All @@ -13,4 +13,4 @@ Pod::Spec.new do |s|
s.source_files = "Sources/*.swift"

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3' }
end
end
7 changes: 6 additions & 1 deletion InteractiveSideMenu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
881EF07A1E30FFE40035DEB4 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0830;
ORGANIZATIONNAME = Handsome;
TargetAttributes = {
881EF0821E30FFE40035DEB4 = {
Expand Down Expand Up @@ -258,12 +258,15 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = is.handsome.InteractiveSideMenu;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -279,11 +282,13 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = is.handsome.InteractiveSideMenu;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
64 changes: 39 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ It supports following customization:
- Using spring animation with params customization
- Animation options like animation curve

All these parameters could vary for different orientations.

# Installation

## CocoaPods
Expand All @@ -31,12 +33,14 @@ github "handsomecode/InteractiveSideMenu"


# Usage
You should use 3 basic ViewControllers for creating subclasses for implementing your side menu.
To implement your side menu you should create subclasses of basic View Controllers.
- ```MenuContainerViewController``` is a host for menu and content views
- ```MenuViewController``` is a container for menu view
- ```MenuItemContentControlller``` is a container for content that corresponds menu item

To setup your side menu you shoud do 3 things:
Also, ensure that every menu item ViewController adopts relevant protocol.
- ```SideMenuItemContent``` is a ViewController's protocol for data that corresponds menu item

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
- Select initial content controller by calling ```selectContentViewController(_ selectedContentVC: MenuItemContentViewController)```
Expand All @@ -48,11 +52,8 @@ class HostViewController: MenuContainerViewController {

override func viewDidLoad() {
super.viewDidLoad()

menuViewController = self.storyboard!.instantiateViewController(withIdentifier: "NavigationMenu") as! MenuViewController

contentViewControllers = contentControllers()

contentViewControllers = contentControllers()
selectContentViewController(contentViewControllers.first!)
}

Expand All @@ -61,40 +62,53 @@ class HostViewController: MenuContainerViewController {
contentList.append(self.storyboard?.instantiateViewController(withIdentifier: "First") as! MenuItemContentViewController)
contentList.append(self.storyboard?.instantiateViewController(withIdentifier: "Second") as! MenuItemContentViewController)
return contentList
}
}
}
```

To show menu you should call ```showMenu()``` method that is available in MenuItemContentViewController class.
To show menu, call ```showSideMenu()``` method from `SideMenuItemContent` protocol.
```swift
import InteractiveSideMenu

class FirstViewController: MenuItemContentViewController {
class KittyViewController: UIViewController, SideMenuItemContent {

@IBAction func didOpenMenu(_ sender: UIButton) {
showMenu()
@IBAction func openMenu(_ sender: UIButton) {
showSideMenu()
}
}
```

To change content view you should choose desired content controller and hide menu.
To change content view, choose desired content controller and hide menu.
```swift
let index = 2 // second menu item
guard let menuContainerViewController = self.menuContainerViewController else { return }
let contentController = menuContainerViewController.contentViewControllers[index]
menuContainerViewController.selectContentViewController(contentController)
menuContainerViewController.hideMenu()
let index = 2 // second menu item
guard let menuContainerViewController = self.menuContainerViewController else { return }
let contentController = menuContainerViewController.contentViewControllers[index]
menuContainerViewController.selectContentViewController(contentController)
menuContainerViewController.hideMenu()
```

To customize animation for menu opening or closing you should override ```menuTransitionOptionsBuilder()``` method that is available in ```MenuContainerViewColtroller``` class.
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 menuTransitionOptionsBuilder() -> TransitionOptionsBuilder? {
return TransitionOptionsBuilder() { builder in
builder.duration = 0.5
builder.contentScale = 1
}
override func viewDidLoad() {
super.viewDidLoad()
let screenSize: CGRect = UIScreen.main.bounds
self.transitionOptions = TransitionOptions(duration: 0.4, visibleContentWidth: screenSize.width / 6)
...
}
```
```

Also, you have possibility to update customization settings, e.g. set another options for landscape orientation. To do it, override ```viewWillTransition(to:with:)``` mehod and add desired parameters to ```transitionOptions``` property.
```swift
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
var options = TransitionOptions()
options.duration = size.width < size.height ? 0.4 : 0.6
options.visibleContentWidth = size.width / 6
self.transitionOptions = options
}
```

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.

Expand Down
51 changes: 43 additions & 8 deletions Sample/Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
881EF0AD1E3102E30035DEB4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 881EF0AB1E3102E30035DEB4 /* Main.storyboard */; };
881EF0AF1E3102E30035DEB4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 881EF0AE1E3102E30035DEB4 /* Assets.xcassets */; };
881EF0B21E3102E30035DEB4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 881EF0B01E3102E30035DEB4 /* LaunchScreen.storyboard */; };
881EF0BD1E31037D0035DEB4 /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881EF0B91E31037D0035DEB4 /* FirstViewController.swift */; };
881EF0BD1E31037D0035DEB4 /* KittyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881EF0B91E31037D0035DEB4 /* KittyViewController.swift */; };
881EF0BE1E31037D0035DEB4 /* HostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881EF0BA1E31037D0035DEB4 /* HostViewController.swift */; };
881EF0BF1E31037D0035DEB4 /* NavigationMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881EF0BB1E31037D0035DEB4 /* NavigationMenuViewController.swift */; };
881EF0C01E31037D0035DEB4 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881EF0BC1E31037D0035DEB4 /* SecondViewController.swift */; };
9A15C5481EDD62BC00C4FD75 /* InteractiveSideMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 881EF0C71E31049C0035DEB4 /* InteractiveSideMenu.framework */; };
9A15C5491EDD62BC00C4FD75 /* InteractiveSideMenu.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 881EF0C71E31049C0035DEB4 /* InteractiveSideMenu.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9A6755031EA8E30C00F0C71D /* TabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A6755021EA8E30C00F0C71D /* TabBarViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -32,27 +34,49 @@
remoteGlobalIDString = 881EF0821E30FFE40035DEB4;
remoteInfo = InteractiveSideMenu;
};
9A15C54A1EDD62BC00C4FD75 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 881EF0C21E31049C0035DEB4 /* InteractiveSideMenu.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 881EF0821E30FFE40035DEB4;
remoteInfo = InteractiveSideMenu;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
9A15C54C1EDD62BC00C4FD75 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
9A15C5491EDD62BC00C4FD75 /* InteractiveSideMenu.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
881EF0A41E3102E30035DEB4 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; };
881EF0A71E3102E30035DEB4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
881EF0AC1E3102E30035DEB4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
881EF0AE1E3102E30035DEB4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
881EF0B11E3102E30035DEB4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
881EF0B31E3102E30035DEB4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
881EF0B91E31037D0035DEB4 /* FirstViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = "<group>"; };
881EF0B91E31037D0035DEB4 /* KittyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KittyViewController.swift; sourceTree = "<group>"; };
881EF0BA1E31037D0035DEB4 /* HostViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = HostViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
881EF0BB1E31037D0035DEB4 /* NavigationMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationMenuViewController.swift; sourceTree = "<group>"; };
881EF0BC1E31037D0035DEB4 /* SecondViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = "<group>"; };
881EF0C21E31049C0035DEB4 /* InteractiveSideMenu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = InteractiveSideMenu.xcodeproj; path = ../InteractiveSideMenu.xcodeproj; sourceTree = "<group>"; };
9A6755021EA8E30C00F0C71D /* TabBarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
881EF0A11E3102E30035DEB4 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9A15C5481EDD62BC00C4FD75 /* InteractiveSideMenu.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -94,8 +118,8 @@
881EF0C11E3103A80035DEB4 /* MenuContentScreens */ = {
isa = PBXGroup;
children = (
881EF0B91E31037D0035DEB4 /* FirstViewController.swift */,
881EF0BC1E31037D0035DEB4 /* SecondViewController.swift */,
881EF0B91E31037D0035DEB4 /* KittyViewController.swift */,
9A6755021EA8E30C00F0C71D /* TabBarViewController.swift */,
);
name = MenuContentScreens;
sourceTree = "<group>";
Expand All @@ -118,11 +142,13 @@
881EF0A01E3102E30035DEB4 /* Sources */,
881EF0A11E3102E30035DEB4 /* Frameworks */,
881EF0A21E3102E30035DEB4 /* Resources */,
9A15C54C1EDD62BC00C4FD75 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
881EF0C91E3104AD0035DEB4 /* PBXTargetDependency */,
9A15C54B1EDD62BC00C4FD75 /* PBXTargetDependency */,
);
name = Sample;
productName = Sample;
Expand Down Expand Up @@ -197,10 +223,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
881EF0C01E31037D0035DEB4 /* SecondViewController.swift in Sources */,
881EF0BD1E31037D0035DEB4 /* FirstViewController.swift in Sources */,
881EF0BD1E31037D0035DEB4 /* KittyViewController.swift in Sources */,
881EF0BE1E31037D0035DEB4 /* HostViewController.swift in Sources */,
881EF0BF1E31037D0035DEB4 /* NavigationMenuViewController.swift in Sources */,
9A6755031EA8E30C00F0C71D /* TabBarViewController.swift in Sources */,
881EF0A81E3102E30035DEB4 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -213,6 +239,11 @@
name = InteractiveSideMenu;
targetProxy = 881EF0C81E3104AD0035DEB4 /* PBXContainerItemProxy */;
};
9A15C54B1EDD62BC00C4FD75 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = InteractiveSideMenu;
targetProxy = 9A15C54A1EDD62BC00C4FD75 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
Expand Down Expand Up @@ -329,8 +360,10 @@
881EF0B71E3102E30035DEB4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Sample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = is.handsome.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -341,8 +374,10 @@
881EF0B81E3102E30035DEB4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Sample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = is.handsome.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Loading