Compare commits

...

11 Commits

Author SHA1 Message Date
rmotygullin 139082d366 FixRotation: (Issues During Rotation) Fix Completed 2021-11-05 14:01:00 +03:00
rmotygullin 08975badd3 FixRotation: Create extension UIDeviceOrientation + Add property Boolean .isRotateAllowed, .face 2021-11-04 14:01:00 +03:00
rmotygullin 410f53dc1c FixRotation: (Issues During Rotation) is isPortrait remove orientation .portraitUpsideDown 2021-11-03 14:01:00 +03:00
mrustaa 7916101d7b Merge branch 'dark_mode' 2020-09-21 12:21:11 +03:00
mrustaa 17313e2bd3 Merge branch 'fix_readme' 2020-09-21 12:18:14 +03:00
mrustaa fc09d21272 add app-icon 2020-09-21 12:10:27 +03:00
Ernesto Rivera 1b85dfa196 Dark mode support 2020-09-16 15:39:17 -04:00
Ernesto Rivera 830bceb3cb Update README.md
Fix sample code
2020-09-16 09:48:01 -04:00
Ernesto Rivera 8b467a2b59 Add @available(iOS 13.0, *) to classes and protocols for improved compatibility 2020-09-16 09:13:01 -04:00
Ernesto Rivera 7656a3f287 Remove unnecessary iOS 13 version check 2020-09-16 09:12:38 -04:00
Rustam aa2f484b6b Update README.md 2020-09-12 03:53:52 +03:00
23 changed files with 120 additions and 32 deletions
@@ -1,48 +1,111 @@
{
"images" : [
{
"idiom" : "iphone",
{
"size" : "20x20",
"scale" : "2x"
"idiom": "iphone",
"filename" : "appIcon-20@2x.png",
"scale": "2x"
},
{
"idiom" : "iphone",
{
"size" : "20x20",
"scale" : "3x"
"idiom": "iphone",
"filename" : "appIcon-20@3x.png",
"scale": "3x"
},
{
"size" : "20x20",
"idiom": "ipad",
"filename" : "appIcon-20.png",
"scale": "1x"
},
{
"size" : "20x20",
"idiom": "ipad",
"filename" : "appIcon-20@2x.png",
"scale": "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "appIcon-29@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "appIcon-29@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "appIcon-40@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "appIcon-40@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "appIcon-60@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "appIcon-60@3x.png",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "appIcon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "appIcon-29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "appIcon-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "appIcon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "appIcon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "appIcon-76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "appIcon-83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "appIcon-1024.png",
"scale" : "1x"
}
],
Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@@ -105,8 +105,7 @@ class MapsViewController: StoryboardController, MapsContainerControllerDelegate,
@objc func rotated() {
let orint = UIDevice.current.orientation
if orint == .faceUp || orint == .faceDown || orint == .portraitUpsideDown { return }
if !UIDevice.current.orientation.isRotateAllowed { return }
updateMapViewTopPadding()
}
+11 -4
View File
@@ -19,7 +19,9 @@ UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/map
<!-- TOC -->
- [Requirements](#requirements)
- [Installation CocoaPods](#installation-cocoapods)
- [Installation](#installation)
- [CocoaPods](#cocoapods)
- [Swift Package Manager with Xcode 11](#swift-package-manager-with-xcode-11)
- [Getting Started](#getting-started)
- [Action](#action)
- [Move position with an animation](#move-position-with-an-animation)
@@ -54,7 +56,9 @@ UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/map
✏️ ContainerController is written in Swift 5.0+. It can be built by Xcode 11 or later. Compatible with iOS 13.0+.
## Installation CocoaPods
## Installation
### CocoaPods
ContainerControllerSwift is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
@@ -62,6 +66,9 @@ it, simply add the following line to your Podfile:
```ruby
pod 'ContainerControllerSwift'
```
### Swift Package Manager with Xcode 11
Follow [this doc](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app).
## Getting Started
@@ -85,7 +92,7 @@ class ViewController: UIViewController, ContainerControllerDelegate {
// Create ContainerController object, along with the container.view
// Pass the current UIViewController
container = ContainerController(addTo: self, layout: layout)
let container = ContainerController(addTo: self, layout: layout)
container.view.cornerRadius = 15
container.view.addShadow()
@@ -465,7 +472,7 @@ func containerControllerMove(_ containerController: ContainerController, positio
## Author
<motionrustam@gmail.com>| [mrustaa](https://github.com/mrustaa/)
<motionrustam@gmail.com> 📩| [mrustaa](https://github.com/mrustaa/)
## License
@@ -8,6 +8,7 @@
import UIKit
@available(iOS 13.0, *)
open class ContainerController: NSObject {
// MARK: Views
@@ -210,8 +211,7 @@ open class ContainerController: NSObject {
@objc func rotated() {
let orint = UIDevice.current.orientation
if orint == .faceUp || orint == .faceDown || orint == .portraitUpsideDown { return }
if !UIDevice.current.orientation.isRotateAllowed { return }
if ContainerDevice.orientation == oldOrientation { return }
oldOrientation = ContainerDevice.orientation
@@ -365,7 +365,7 @@ open class ContainerController: NSObject {
private func createContainerView() {
let frame = CGRect(x: 0, y: 0, width: deviceWidth, height: deviceHeight * 2)
view = ContainerView(frame: frame)
view.backgroundColor = .white
view.backgroundColor = .systemBackground
controller?.view.addSubview(view)
panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePan(_:)))
@@ -1090,6 +1090,7 @@ open class ContainerController: NSObject {
// MARK: - Gesture Delegate
@available(iOS 13.0, *)
extension ContainerController: UIGestureRecognizerDelegate {
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
@@ -1100,6 +1101,7 @@ extension ContainerController: UIGestureRecognizerDelegate {
// MARK: - Table Delegate
@available(iOS 13.0, *)
extension ContainerController: UITableViewDelegate {
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
@@ -1119,6 +1121,7 @@ extension ContainerController: UITableViewDelegate {
// MARK: - Table DataSource
@available(iOS 13.0, *)
extension ContainerController: UITableViewDataSource {
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
@@ -1151,6 +1154,7 @@ extension ContainerController: UITableViewDataSource {
// MARK: - Collection Delegate
@available(iOS 13.0, *)
extension ContainerController: UICollectionViewDelegate {
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
@@ -1163,6 +1167,7 @@ extension ContainerController: UICollectionViewDelegate {
// MARK: - Collection DataSource
@available(iOS 13.0, *)
extension ContainerController: UICollectionViewDataSource {
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
@@ -1182,6 +1187,7 @@ extension ContainerController: UICollectionViewDataSource {
// MARK: - Collection DelegateFlowLayout
@available(iOS 13.0, *)
extension ContainerController: UICollectionViewDelegateFlowLayout {
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
@@ -1194,6 +1200,7 @@ extension ContainerController: UICollectionViewDelegateFlowLayout {
// MARK: - Scroll Delegate
@available(iOS 13.0, *)
extension ContainerController: UIScrollViewDelegate {
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
@@ -8,6 +8,7 @@
import UIKit
@available(iOS 13.0, *)
public protocol ContainerControllerDelegate {
/// Reports rotation and orientation changes
@@ -21,6 +22,7 @@ public protocol ContainerControllerDelegate {
}
@available(iOS 13.0, *)
public extension ContainerControllerDelegate {
func containerControllerRotation(_ containerController: ContainerController) {
@@ -8,8 +8,8 @@
import UIKit
@available(iOS 13.0, *)
public extension ContainerDevice {
enum Orientation {
case portrait
case landscapeLeft
@@ -17,6 +17,7 @@ public extension ContainerDevice {
}
}
@available(iOS 13.0, *)
open class ContainerDevice {
// MARK: - Size
@@ -62,12 +63,8 @@ open class ContainerDevice {
class public var statusBarHeight: CGFloat {
var height: CGFloat = 0
if #available(iOS 13.0, *) {
let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
height = window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
} else {
height = UIApplication.shared.statusBarFrame.height
}
let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
height = window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
return height
}
@@ -87,7 +84,7 @@ open class ContainerDevice {
switch UIDevice.current.orientation {
case .landscapeLeft, .landscapeRight:
portrait = false
case .portrait, .portraitUpsideDown:
case .portrait:
portrait = true
default: break
}
@@ -122,6 +119,18 @@ open class ContainerDevice {
return .landscapeLeft
}
}
}
public extension UIDeviceOrientation {
var isRotateAllowed: Bool {
return !(face || self == .portraitUpsideDown)
}
var face: Bool {
switch self {
case .faceUp, .faceDown: return true
default: return false
}
}
}
@@ -8,6 +8,7 @@
import UIKit
@available(iOS 13.0, *)
open class ContainerView: UIView {
public var contentView: UIView?
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB