Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0534cba5df | |||
| 831b2f144f | |||
| 8bff1e5c24 | |||
| 4f1ca8157a | |||
| 8d6589004b | |||
| 3993d4d003 | |||
| f2e8d4411f | |||
| 3c2848ffd1 | |||
| f162d50891 | |||
| 9f34fcb70c | |||
| fed617321f | |||
| 139082d366 | |||
| ca43421a8f | |||
| 08975badd3 | |||
| 72759913ae | |||
| 410f53dc1c | |||
| 7916101d7b | |||
| 17313e2bd3 | |||
| fc09d21272 | |||
| 1b85dfa196 | |||
| 830bceb3cb | |||
| 8b467a2b59 | |||
| 7656a3f287 | |||
| aa2f484b6b |
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'ContainerControllerSwift'
|
||||
s.version = '1.1.2'
|
||||
s.version = '1.1.4'
|
||||
s.summary = 'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
@@ -33,7 +33,7 @@ TODO: Add long description of the pod here.
|
||||
# s.ios.deployment_target = '13.0'
|
||||
s.platform = :ios, "13.0"
|
||||
|
||||
s.source_files = 'ContainerControllerSwift/**/*.{swift}'
|
||||
s.source_files = 'Sources/**/*.{swift}'
|
||||
|
||||
s.framework = "UIKit"
|
||||
# s.ios.framework = 'UIKit'
|
||||
|
||||
@@ -1,33 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="aV9-EX-QWJ">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="cIu-62-xtU">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ContainerControllerSwift_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ContainerController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="UYm-tY-WGa" customClass="TableAdapterView" customModule="ContainerControllerSwift">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="UYm-tY-WGa" secondAttribute="bottom" id="Usw-ep-vba"/>
|
||||
<constraint firstItem="UYm-tY-WGa" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="qmS-hQ-rSa"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="UYm-tY-WGa" secondAttribute="trailing" id="vQK-T0-eQf"/>
|
||||
<constraint firstItem="UYm-tY-WGa" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="wXp-OO-MUn"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="x48-lm-dG7"/>
|
||||
<connections>
|
||||
@@ -39,20 +41,31 @@
|
||||
<point key="canvasLocation" x="132" y="137.18140929535232"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="2WA-6t-2aK">
|
||||
<scene sceneID="jWl-Kd-Y9J">
|
||||
<objects>
|
||||
<navigationController id="aV9-EX-QWJ" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translucent="NO" id="QWK-gZ-mYK">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<navigationController id="cIu-62-xtU" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" translucent="NO" id="y83-TR-htY">
|
||||
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<color key="barTintColor" systemColor="secondaryLabelColor"/>
|
||||
<navigationBarAppearance key="compactAppearance"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="SPa-ED-zkK"/>
|
||||
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="Lpq-ZC-BiY"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Uhq-S7-WHN" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="bJL-5a-VyA" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-631" y="137"/>
|
||||
<point key="canvasLocation" x="-855" y="137"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="secondaryLabelColor">
|
||||
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -14,13 +16,44 @@
|
||||
<view key="view" contentMode="scaleToFill" id="jmi-Lo-St4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gqJ-oN-JCK">
|
||||
<rect key="frame" x="110.5" y="50" width="154" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="MXC-rS-qfY"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="18"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="isTranslucent true">
|
||||
<color key="titleColor" systemColor="systemBlueColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="btnChangeTranslucentAction:" destination="p3c-kf-PfN" eventType="touchUpInside" id="hjO-rR-Ij1"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="QCP-uk-H24"/>
|
||||
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="gqJ-oN-JCK" firstAttribute="top" secondItem="QCP-uk-H24" secondAttribute="top" constant="30" id="2Vg-iw-6Rl"/>
|
||||
<constraint firstItem="gqJ-oN-JCK" firstAttribute="centerX" secondItem="jmi-Lo-St4" secondAttribute="centerX" id="Crs-BD-puY"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="btnChangeTranslucent" destination="gqJ-oN-JCK" id="34t-Kh-blv"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Uzt-sR-4xA" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="781.15942028985512" y="43.526785714285715"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="opaqueSeparatorColor">
|
||||
<color red="0.77647058823529413" green="0.77647058823529413" blue="0.78431372549019607" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemBlueColor">
|
||||
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -13,11 +13,15 @@ class ExampleAddCollectionViewController: StoryboardController {
|
||||
|
||||
var container: ContainerController!
|
||||
|
||||
@IBOutlet var btnChangeTranslucent: UIButton!
|
||||
// MARK: - Init
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = "Example Add CollectionView"
|
||||
|
||||
btnUpdateText()
|
||||
|
||||
let layoutC = ContainerLayout()
|
||||
layoutC.positions = ContainerPosition(top: 100, middle: 250, bottom: 70)
|
||||
@@ -33,6 +37,24 @@ class ExampleAddCollectionViewController: StoryboardController {
|
||||
container.move(type: .middle)
|
||||
}
|
||||
|
||||
@IBAction func btnChangeTranslucentAction(_ sender: UIButton) {
|
||||
|
||||
guard let translucent = navigationController?.navigationBar.isTranslucent else { return }
|
||||
|
||||
navigationController?.navigationBar.isTranslucent = !translucent
|
||||
|
||||
btnUpdateText()
|
||||
|
||||
container.move(type: container.moveType)
|
||||
}
|
||||
|
||||
func btnUpdateText() {
|
||||
|
||||
guard let translucent = navigationController?.navigationBar.isTranslucent else { return }
|
||||
|
||||
btnChangeTranslucent.setTitle("NavBar isTranslucent \(translucent)", for: .normal)
|
||||
}
|
||||
|
||||
func addCollectionView() -> UICollectionView {
|
||||
|
||||
let layout = UICollectionViewFlowLayout()
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -14,8 +16,8 @@
|
||||
<view key="view" contentMode="scaleToFill" id="jmi-Lo-St4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<viewLayoutGuide key="safeArea" id="QCP-uk-H24"/>
|
||||
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Uzt-sR-4xA" sceneMemberID="firstResponder"/>
|
||||
@@ -23,4 +25,9 @@
|
||||
<point key="canvasLocation" x="781.15942028985512" y="43.526785714285715"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="opaqueSeparatorColor">
|
||||
<color red="0.77647058820000003" green="0.77647058820000003" blue="0.7843137255" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -18,6 +18,8 @@ class ExampleAddTableViewController: StoryboardController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = "Example Add TableView"
|
||||
|
||||
let layout = ContainerLayout()
|
||||
layout.backgroundShadowShow = true
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 100)
|
||||
|
||||
@@ -70,6 +70,9 @@ class ExamplesContainerController: ContainerController, ExampleCellDelegate {
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .shadowBackground, value: false),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .shadowContainer, value: 0.2, maximumValue: 1.0),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .cornerRadius, value: 15, maximumValue: 140),
|
||||
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .navbarTranslucent, value: false),
|
||||
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .movingEnabled, value: true),
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .trackingPosition, value: false),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .footerPadding, value: 0, maximumValue: Float(ContainerDevice.screenMax)),
|
||||
@@ -122,6 +125,8 @@ class ExamplesContainerController: ContainerController, ExampleCellDelegate {
|
||||
|
||||
case .shadowContainer: self.view.addShadow(opacity: value)
|
||||
|
||||
case .navbarTranslucent: self.controller?.navigationController?.navigationBar.isTranslucent = boolValue; move(type: moveType)
|
||||
|
||||
case .movingEnabled: set(movingEnabled: boolValue)
|
||||
|
||||
case .trackingPosition: set(trackingPosition: boolValue)
|
||||
|
||||
@@ -19,6 +19,8 @@ class ExamplesSettingsViewController: StoryboardController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = "Example Add/Settings Container"
|
||||
|
||||
let barButtonAddItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(navigationBarAddAction))
|
||||
let barButtonCloseItem = UIBarButtonItem(barButtonSystemItem: .close, target: self, action: #selector(navigationBarCloseAction))
|
||||
self.navigationItem.rightBarButtonItems = [ barButtonAddItem, barButtonCloseItem ]
|
||||
|
||||
@@ -20,6 +20,7 @@ extension ExampleCell {
|
||||
public enum Style: String {
|
||||
case `default` = ""
|
||||
case shadowContainer = "ShadowContainer"
|
||||
case navbarTranslucent = "NavbarTranslucent"
|
||||
case movingEnabled = "MovingEnabled"
|
||||
case cornerRadius = "CornerRadius"
|
||||
case footerPadding = "FooterView.Padding"
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
|
After Width: | Height: | Size: 404 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 22 KiB |
@@ -44,13 +44,16 @@ class MapViewManager: NSObject {
|
||||
// MARK: - Location Manager
|
||||
|
||||
func loadLocation() {
|
||||
|
||||
if CLLocationManager.locationServicesEnabled() {
|
||||
locationManager = CLLocationManager()
|
||||
locationManager?.delegate = self
|
||||
locationManager?.desiredAccuracy = kCLLocationAccuracyBest
|
||||
locationManager?.requestAlwaysAuthorization()
|
||||
locationManager?.startUpdatingLocation()
|
||||
DispatchQueue.global().async {
|
||||
if CLLocationManager.locationServicesEnabled() {
|
||||
DispatchQueue.main.async {
|
||||
self.locationManager = CLLocationManager()
|
||||
self.locationManager?.delegate = self
|
||||
self.locationManager?.desiredAccuracy = kCLLocationAccuracyBest
|
||||
self.locationManager?.requestAlwaysAuthorization()
|
||||
self.locationManager?.startUpdatingLocation()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ class MapsViewController: StoryboardController, MapsContainerControllerDelegate,
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
navigationController?.navigationBar.isTranslucent = false
|
||||
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
|
||||
navBar(hide: true)
|
||||
@@ -105,8 +107,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()
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ViewController: UIViewController {
|
||||
|
||||
navigationController?.interactivePopGestureRecognizer?.delegate = self
|
||||
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
|
||||
|
||||
navigationController?.view.backgroundColor = .systemGroupedBackground
|
||||
items = [
|
||||
TitleTextItem(title: "Maps.app", clss: MapsViewController.self),
|
||||
TitleTextItem(title: "Example. Settings", clss: ExamplesSettingsViewController.self),
|
||||
|
||||
@@ -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/) JUNE 2020
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
open class ContainerController: NSObject {
|
||||
|
||||
// MARK: Views
|
||||
@@ -210,15 +211,14 @@ 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
|
||||
|
||||
shadowHiddenCheck()
|
||||
|
||||
delegate?.containerControllerRotation(self)
|
||||
delegate?.containerControllerRotation?(self)
|
||||
|
||||
calculationView()
|
||||
calculationScrollViewHeight(from: .rotation)
|
||||
@@ -357,7 +357,7 @@ open class ContainerController: NSObject {
|
||||
}
|
||||
|
||||
@objc private func shadowButtonAction() {
|
||||
delegate?.containerControllerShadowClick(self)
|
||||
delegate?.containerControllerShadowClick?(self)
|
||||
}
|
||||
|
||||
// MARK: - Create Container-View
|
||||
@@ -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(_:)))
|
||||
@@ -477,7 +477,11 @@ open class ContainerController: NSObject {
|
||||
transform.ty = ((positionTop / 2) + (transform.ty / 2))
|
||||
}
|
||||
|
||||
let position = transform.ty
|
||||
var position = transform.ty
|
||||
if topTranslucent {
|
||||
position = position + topBarHeight
|
||||
}
|
||||
|
||||
let type: ContainerMoveType = moveType
|
||||
let from: ContainerFromType = .pan
|
||||
let animation = false
|
||||
@@ -555,7 +559,7 @@ open class ContainerController: NSObject {
|
||||
scrollInsetsBottom = 0.0
|
||||
}
|
||||
|
||||
let top: CGFloat = layout.scrollInsets.top
|
||||
var top: CGFloat = layout.scrollInsets.top
|
||||
let bottom: CGFloat = layout.scrollInsets.bottom + scrollInsetsBottom
|
||||
|
||||
let indicatorTop: CGFloat = layout.scrollIndicatorInsets.top
|
||||
@@ -575,6 +579,10 @@ open class ContainerController: NSObject {
|
||||
height = 0
|
||||
}
|
||||
|
||||
if topTranslucent {
|
||||
height = height + topBarHeight
|
||||
}
|
||||
|
||||
if animation ,
|
||||
!isScrolling,
|
||||
footerView == nil,
|
||||
@@ -735,7 +743,10 @@ open class ContainerController: NSObject {
|
||||
from: ContainerFromType = .custom,
|
||||
completion: (() -> Void)? = nil) {
|
||||
|
||||
let position = positionMoveFrom(type: type)
|
||||
var position = positionMoveFrom(type: type)
|
||||
if topTranslucent {
|
||||
position = position + topBarHeight
|
||||
}
|
||||
|
||||
move(position: position,
|
||||
animation: animation,
|
||||
@@ -834,7 +845,7 @@ open class ContainerController: NSObject {
|
||||
type: ContainerMoveType,
|
||||
animation: Bool) {
|
||||
|
||||
delegate?.containerControllerMove(self, position: position, type: type, animation: animation)
|
||||
delegate?.containerControllerMove?(self, position: position, type: type, animation: animation)
|
||||
}
|
||||
|
||||
//MARK: - Shadow Alpha Level
|
||||
@@ -1090,6 +1101,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 +1112,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 +1132,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 +1165,7 @@ extension ContainerController: UITableViewDataSource {
|
||||
|
||||
// MARK: - Collection Delegate
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UICollectionViewDelegate {
|
||||
|
||||
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
@@ -1163,6 +1178,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 +1198,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 +1211,7 @@ extension ContainerController: UICollectionViewDelegateFlowLayout {
|
||||
|
||||
// MARK: - Scroll Delegate
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
extension ContainerController: UIScrollViewDelegate {
|
||||
|
||||
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
@@ -1222,7 +1240,10 @@ extension ContainerController: UIScrollViewDelegate {
|
||||
|
||||
scrollTransform = view.transform
|
||||
|
||||
let top: CGFloat = positionTop
|
||||
var top: CGFloat = positionTop
|
||||
if topTranslucent {
|
||||
top = top + topBarHeight
|
||||
}
|
||||
|
||||
if gesture.state == .ended {
|
||||
scrollOnceBeginDragging = false
|
||||
|
||||
@@ -8,29 +8,17 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
public protocol ContainerControllerDelegate {
|
||||
@available(iOS 13.0, *)
|
||||
@objc public protocol ContainerControllerDelegate {
|
||||
|
||||
/// Reports rotation and orientation changes
|
||||
func containerControllerRotation(_ containerController: ContainerController)
|
||||
@objc optional func containerControllerRotation(_ containerController: ContainerController)
|
||||
|
||||
/// Reports a click on the background shadow
|
||||
func containerControllerShadowClick(_ containerController: ContainerController)
|
||||
@objc optional func containerControllerShadowClick(_ containerController: ContainerController)
|
||||
|
||||
/// Reports the changes current position of the container, after its use
|
||||
func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
@objc optional func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
|
||||
}
|
||||
|
||||
public extension ContainerControllerDelegate {
|
||||
|
||||
func containerControllerRotation(_ containerController: ContainerController) {
|
||||
}
|
||||
|
||||
|
||||
func containerControllerShadowClick(_ containerController: ContainerController) {
|
||||
}
|
||||
|
||||
func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import UIKit
|
||||
|
||||
typealias ContainerCompletion = () -> Void
|
||||
|
||||
public enum ContainerMoveType {
|
||||
@objc public enum ContainerMoveType: Int {
|
||||
case top
|
||||
case middle
|
||||
case bottom
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
open class ContainerView: UIView {
|
||||
|
||||
public var contentView: UIView?
|
||||
|
||||