Skip to content

Commit f2523a7

Browse files
Merge pull request #4 from SimformSolutionsPvtLtd/feature/iPad_Support
added iPad support
2 parents 42eb2c5 + 5f68c1a commit f2523a7

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

Example/SSCustomSideMenu.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,12 @@
484484
MODULE_NAME = ExampleApp;
485485
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
486486
PRODUCT_NAME = "$(TARGET_NAME)";
487+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
488+
SUPPORTS_MACCATALYST = NO;
489+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
487490
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
488491
SWIFT_VERSION = 4.0;
492+
TARGETED_DEVICE_FAMILY = "1,2";
489493
};
490494
name = Debug;
491495
};
@@ -500,8 +504,12 @@
500504
MODULE_NAME = ExampleApp;
501505
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
502506
PRODUCT_NAME = "$(TARGET_NAME)";
507+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
508+
SUPPORTS_MACCATALYST = NO;
509+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
503510
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
504511
SWIFT_VERSION = 4.0;
512+
TARGETED_DEVICE_FAMILY = "1,2";
505513
};
506514
name = Release;
507515
};

Example/SSCustomSideMenu/Info.plist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@
3232
</array>
3333
<key>UISupportedInterfaceOrientations</key>
3434
<array>
35+
<string>UIInterfaceOrientationLandscapeLeft</string>
3536
<string>UIInterfaceOrientationPortrait</string>
37+
</array>
38+
<key>UISupportedInterfaceOrientations~ipad</key>
39+
<array>
3640
<string>UIInterfaceOrientationLandscapeLeft</string>
41+
<string>UIInterfaceOrientationLandscapeRight</string>
42+
<string>UIInterfaceOrientationPortrait</string>
43+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
3744
</array>
3845
</dict>
3946
</plist>

Sources/SSCustomSideMenu/Classes/SSSideMenuContainerViewController.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,35 @@ open class SSSideMenuContainerViewController: UIViewController {
4747
}
4848
}
4949

50+
open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
51+
super.viewWillTransition(to: size, with: coordinator)
52+
if isExpanded {
53+
tapGesture?.isEnabled = false
54+
UIView.animate(withDuration: ssMenuConfig.animationDuration, delay: 0, usingSpringWithDamping: ssMenuConfig.damping, initialSpringVelocity: 0, options: .curveEaseInOut, animations: { [weak self] in
55+
guard let self else { return }
56+
performCloseAnimation()
57+
}) { [weak self] (_) in
58+
guard let self else { return }
59+
switch ssMenuConfig.animationType {
60+
case .compress(_):
61+
load(self.ssMenuConfig.homeController, on: self.contentContainerView)
62+
default:
63+
break
64+
}
65+
imageView.removeFromSuperview()
66+
if let selectedIndexPath = ssMenuConfig.menuTable.selectedIndexPath?.row {
67+
didSelectMenuOption(menuOption: selectedIndexPath)
68+
}
69+
}
70+
}
71+
self.ssMenuConfig.menuWidth = UIScreen.main.bounds.width / 2
72+
coordinator.animate(alongsideTransition: { [weak self] _ in
73+
guard let self else { return }
74+
contentContainerView.frame = CGRect(x: 0, y: 0, width: view.bounds.size.width, height: view.bounds.size.height)
75+
imageView.frame = contentContainerView.frame
76+
}, completion: nil)
77+
}
78+
5079
// MARK: -
5180
// MARK: - Class Functions
5281

0 commit comments

Comments
 (0)