Skip to content

Commit 64dca8c

Browse files
author
Alexander Perechnev
committed
Merge branch 'release/1.1.0'
2 parents 114d5eb + 2b275c2 commit 64dca8c

6 files changed

Lines changed: 76 additions & 11 deletions

File tree

SidebarOverlay.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Pod::Spec.new do |s|
22
s.name = "SidebarOverlay"
3-
s.version = "1.0.1"
3+
s.version = "1.1.0"
44
s.summary = "Yet another implementation of sidebar menu, but here your menu appears over the top view controller."
55

66
s.description = "Yet another implementation of sidebar menu, but here your menu appears over the top view controller. You questions and pull requests are wolcome."
77

88
s.homepage = "https://github.com/aperechnev/SidebarOverlay"
99
s.license = { :type => 'MIT', :file => 'LICENSE' }
1010
s.author = { "Alexander Perechnev" => "herfleisch@me.com" }
11-
s.source = { :git => "https://github.com/aperechnev/SidebarOverlay.git", :tag => "1.0.1" }
11+
s.source = { :git => "https://github.com/aperechnev/SidebarOverlay.git", :tag => "1.1.0" }
1212

1313
s.platform = :ios, '8.0'
1414
s.source_files = 'SidebarOverlay/SidebarOverlay/*.{h,m,swift}'

SidebarOverlay/SidebarOverlay.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@
320320
DYLIB_INSTALL_NAME_BASE = "@rpath";
321321
INFOPLIST_FILE = SidebarOverlay/Info.plist;
322322
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
323+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
323324
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
324325
PRODUCT_BUNDLE_IDENTIFIER = ru.perechnev.SidebarOverlay;
325326
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -338,6 +339,7 @@
338339
DYLIB_INSTALL_NAME_BASE = "@rpath";
339340
INFOPLIST_FILE = SidebarOverlay/Info.plist;
340341
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
342+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
341343
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
342344
PRODUCT_BUNDLE_IDENTIFIER = ru.perechnev.SidebarOverlay;
343345
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -384,6 +386,7 @@
384386
322EAC251C2B3F830077D684 /* Release */,
385387
);
386388
defaultConfigurationIsVisible = 0;
389+
defaultConfigurationName = Release;
387390
};
388391
322EAC261C2B3F830077D684 /* Build configuration list for PBXNativeTarget "SidebarOverlayTests" */ = {
389392
isa = XCConfigurationList;
@@ -392,6 +395,7 @@
392395
322EAC281C2B3F830077D684 /* Release */,
393396
);
394397
defaultConfigurationIsVisible = 0;
398+
defaultConfigurationName = Release;
395399
};
396400
/* End XCConfigurationList section */
397401
};

SidebarOverlay/SidebarOverlay/SOContainerViewController.swift

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ public protocol SOContainerViewControllerDelegate {
2121
}
2222

2323

24+
public extension UIViewController {
25+
26+
func so_container() -> SOContainerViewController? {
27+
var parentVC: UIViewController? = self
28+
29+
repeat {
30+
if parentVC is SOContainerViewController {
31+
return parentVC as? SOContainerViewController
32+
}
33+
parentVC = parentVC!.parentViewController
34+
}
35+
while (parentVC != nil)
36+
37+
return nil
38+
}
39+
40+
}
41+
42+
2443
public class SOContainerViewController: UIViewController {
2544

2645
public var delegate: SOContainerViewControllerDelegate?
@@ -30,12 +49,18 @@ public class SOContainerViewController: UIViewController {
3049
oldValue?.view.removeFromSuperview()
3150
oldValue?.removeFromParentViewController()
3251

33-
self.view.addSubview((topViewController?.view)!)
34-
self.addChildViewController(topViewController!)
35-
topViewController?.didMoveToParentViewController(self)
36-
topViewController?.view.addGestureRecognizer(self.createPanGestureRecognizer())
37-
38-
self.view.bringSubviewToFront(self.view)
52+
if let topVC = self.topViewController {
53+
topVC.willMoveToParentViewController(self)
54+
55+
self.addChildViewController(topVC)
56+
self.view.addSubview(topVC.view)
57+
58+
topVC.didMoveToParentViewController(self)
59+
60+
topVC.view.addGestureRecognizer(self.createPanGestureRecognizer())
61+
62+
self.view.bringSubviewToFront(self.view)
63+
}
3964

4065
if let vc = self.leftViewController {
4166
self.view.bringSubviewToFront(vc.view)
@@ -66,7 +91,7 @@ public class SOContainerViewController: UIViewController {
6691
self.view.addGestureRecognizer(self.createPanGestureRecognizer())
6792
}
6893

69-
private func setMenuOpened(opened: Bool) {
94+
public func setMenuOpened(opened: Bool) {
7095
var frameToApply = self.leftViewController?.view.frame
7196
frameToApply?.origin.x = opened ? LeftViewControllerOpenedLeftOffset : -(self.leftViewController?.view.frame.size.width)!
7297

SidebarOverlayExample/SidebarOverlayExample.xcodeproj/project.pbxproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
322EAC4F1C2BC04E0077D684 /* SidebarOverlayExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322EAC4E1C2BC04E0077D684 /* SidebarOverlayExampleTests.swift */; };
1616
322EAC5A1C2BC04E0077D684 /* SidebarOverlayExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322EAC591C2BC04E0077D684 /* SidebarOverlayExampleUITests.swift */; };
1717
322EAC681C2BC0770077D684 /* SidebarOverlay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 322EAC671C2BC0770077D684 /* SidebarOverlay.framework */; };
18+
32E5BFCF1C380D590027BF9C /* TopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32E5BFCE1C380D590027BF9C /* TopViewController.swift */; };
1819
/* End PBXBuildFile section */
1920

2021
/* Begin PBXContainerItemProxy section */
@@ -49,6 +50,7 @@
4950
322EAC591C2BC04E0077D684 /* SidebarOverlayExampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarOverlayExampleUITests.swift; sourceTree = "<group>"; };
5051
322EAC5B1C2BC04E0077D684 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5152
322EAC671C2BC0770077D684 /* SidebarOverlay.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SidebarOverlay.framework; path = "../../../Library/Developer/Xcode/DerivedData/SidebarOverlay-baikgxfpgcdwuaccxrpmfvnteolh/Build/Products/Debug-iphoneos/SidebarOverlay.framework"; sourceTree = "<group>"; };
53+
32E5BFCE1C380D590027BF9C /* TopViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopViewController.swift; sourceTree = "<group>"; };
5254
/* End PBXFileReference section */
5355

5456
/* Begin PBXFrameworksBuildPhase section */
@@ -103,6 +105,7 @@
103105
children = (
104106
322EAC391C2BC04D0077D684 /* AppDelegate.swift */,
105107
322EAC3B1C2BC04E0077D684 /* ViewController.swift */,
108+
32E5BFCE1C380D590027BF9C /* TopViewController.swift */,
106109
322EAC3D1C2BC04E0077D684 /* Main.storyboard */,
107110
322EAC401C2BC04E0077D684 /* Assets.xcassets */,
108111
322EAC421C2BC04E0077D684 /* LaunchScreen.storyboard */,
@@ -260,6 +263,7 @@
260263
isa = PBXSourcesBuildPhase;
261264
buildActionMask = 2147483647;
262265
files = (
266+
32E5BFCF1C380D590027BF9C /* TopViewController.swift in Sources */,
263267
322EAC3C1C2BC04E0077D684 /* ViewController.swift in Sources */,
264268
322EAC3A1C2BC04D0077D684 /* AppDelegate.swift in Sources */,
265269
);
@@ -402,6 +406,7 @@
402406
buildSettings = {
403407
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
404408
INFOPLIST_FILE = SidebarOverlayExample/Info.plist;
409+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
405410
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
406411
PRODUCT_BUNDLE_IDENTIFIER = ru.perechnev.SidebarOverlayExample;
407412
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -413,6 +418,7 @@
413418
buildSettings = {
414419
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
415420
INFOPLIST_FILE = SidebarOverlayExample/Info.plist;
421+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
416422
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
417423
PRODUCT_BUNDLE_IDENTIFIER = ru.perechnev.SidebarOverlayExample;
418424
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -486,6 +492,7 @@
486492
322EAC601C2BC04E0077D684 /* Release */,
487493
);
488494
defaultConfigurationIsVisible = 0;
495+
defaultConfigurationName = Release;
489496
};
490497
322EAC611C2BC04E0077D684 /* Build configuration list for PBXNativeTarget "SidebarOverlayExampleTests" */ = {
491498
isa = XCConfigurationList;
@@ -494,6 +501,7 @@
494501
322EAC631C2BC04E0077D684 /* Release */,
495502
);
496503
defaultConfigurationIsVisible = 0;
504+
defaultConfigurationName = Release;
497505
};
498506
322EAC641C2BC04E0077D684 /* Build configuration list for PBXNativeTarget "SidebarOverlayExampleUITests" */ = {
499507
isa = XCConfigurationList;
@@ -502,6 +510,7 @@
502510
322EAC661C2BC04E0077D684 /* Release */,
503511
);
504512
defaultConfigurationIsVisible = 0;
513+
defaultConfigurationName = Release;
505514
};
506515
/* End XCConfigurationList section */
507516
};

SidebarOverlayExample/SidebarOverlayExample/Base.lproj/Main.storyboard

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
</objects>
5050
<point key="canvasLocation" x="102" y="796"/>
5151
</scene>
52-
<!--View Controller-->
52+
<!--Top View Controller-->
5353
<scene sceneID="c8g-nk-kGT">
5454
<objects>
55-
<viewController storyboardIdentifier="topScreen" id="tg8-vv-gHx" sceneMemberID="viewController">
55+
<viewController storyboardIdentifier="topScreen" id="tg8-vv-gHx" customClass="TopViewController" customModule="SidebarOverlayExample" customModuleProvider="target" sceneMemberID="viewController">
5656
<layoutGuides>
5757
<viewControllerLayoutGuide type="top" id="xAz-bg-nAj"/>
5858
<viewControllerLayoutGuide type="bottom" id="9zz-My-v7X"/>
@@ -67,6 +67,13 @@
6767
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
6868
<nil key="highlightedColor"/>
6969
</label>
70+
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="f67-QT-dY5">
71+
<rect key="frame" x="82" y="274" width="130" height="30"/>
72+
<state key="normal" title="Show me my menu"/>
73+
<connections>
74+
<action selector="showMeMyMenu" destination="tg8-vv-gHx" eventType="touchUpInside" id="9bc-Lw-hXS"/>
75+
</connections>
76+
</button>
7077
</subviews>
7178
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
7279
</view>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// TopViewController.swift
3+
// SidebarOverlayExample
4+
//
5+
// Created by Alexander Perechnev on 1/2/16.
6+
// Copyright © 2016 Alexander Perechnev. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
12+
class TopViewController: UIViewController {
13+
14+
@IBAction func showMeMyMenu () {
15+
if let container = self.so_container() {
16+
container.setMenuOpened(true)
17+
}
18+
}
19+
20+
}

0 commit comments

Comments
 (0)