mrustaa / Containercontroller
Licence: mit
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273
Programming Languages
swift
15916 projects
Labels
Projects that are alternatives of or similar to Containercontroller
Fapaginationlayout
Collection view pagination layout
Stars: ✭ 276 (+1.1%)
Mutual labels: xcode, cocoapods, layout, collectionview
Parallaxheader
Simple way to add parallax header to UIScrollView/UITableView written in Swift.
Stars: ✭ 808 (+195.97%)
Mutual labels: xcode, cocoapods, tableview, scrollview
Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (+252.75%)
Mutual labels: xcode, cocoapods, swift-package-manager
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+332.23%)
Mutual labels: xcode, cocoapods, swift-package-manager
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+3821.61%)
Mutual labels: xcode, cocoapods, swift-package-manager
Dtpagercontroller
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
Stars: ✭ 240 (-12.09%)
Mutual labels: xcode, cocoapods, swift-package-manager
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-88.64%)
Mutual labels: xcode, cocoapods, swift-package-manager
Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-67.03%)
Mutual labels: xcode, cocoapods, swift-package-manager
Snapkit
A Swift Autolayout DSL for iOS & OS X
Stars: ✭ 18,091 (+6526.74%)
Mutual labels: xcode, cocoapods, layout
Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-54.21%)
Mutual labels: xcode, cocoapods, tableview
Emptykit
A lightweight, swift library for displaying emptyView whenever the view(tableView/collectionView) has no content to display, just like DZNEmptyDataSet
Stars: ✭ 117 (-57.14%)
Mutual labels: xcode, tableview, collectionview
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (-52.01%)
Mutual labels: xcode, cocoapods, swift-package-manager
Dtphotoviewercontroller
A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.
Stars: ✭ 212 (-22.34%)
Mutual labels: xcode, cocoapods, swift-package-manager
Mylinearlayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITab…
Stars: ✭ 4,152 (+1420.88%)
Mutual labels: xcode, cocoapods, layout
Swift5 Module Template
An opinionated starting point for awesome, reusable Swift 5 modules
Stars: ✭ 331 (+21.25%)
Mutual labels: xcode, cocoapods, swift-package-manager
Dtgradientbutton
Easy way to set gradient background to your buttons.
Stars: ✭ 76 (-72.16%)
Mutual labels: xcode, cocoapods, swift-package-manager
Roundcode
Custom rounded QR code with lots of customization.
Stars: ✭ 267 (-2.2%)
Mutual labels: xcode, cocoapods, swift-package-manager
Alamofire
Elegant HTTP Networking in Swift
Stars: ✭ 36,896 (+13415.02%)
Mutual labels: xcode, cocoapods, swift-package-manager
Accordionswift
The best way of implement an accordion menu using an UITableView in Swift
Stars: ✭ 156 (-42.86%)
Mutual labels: xcode, cocoapods, tableview
ContainerController
UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/
Preview
- Requirements
- Installation
- Getting Started
- Action
- Adding possible custom subviews in ContainerController view
- Settings ⚙️
- ContainerController
Delegate
- Author
- License
Requirements
✏️ ContainerController is written in Swift 5.0+. It can be built by Xcode 11 or later. Compatible with iOS 13.0+.
Installation
CocoaPods
ContainerControllerSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ContainerControllerSwift'
Swift Package Manager with Xcode 11
Follow this doc.
Getting Started
import UIKit
import ContainerControllerSwift
class ViewController: UIViewController, ContainerControllerDelegate {
var container: ContainerController!
override func viewDidLoad() {
super.viewDidLoad()
// Create ContainerController Layout object
let layout = ContainerLayout()
layout.startPosition = .hide
layout.backgroundShadowShow = true
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
// Create ContainerController object, along with the container.view
// Pass the current UIViewController
let container = ContainerController(addTo: self, layout: layout)
container.view.cornerRadius = 15
container.view.addShadow()
// Create subclass scrollView
let tableView = UITableView()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.delegate = self
tableView.dataSource = self
// Add scrollView to container
container.add(scrollView: tableView)
// Finishing settings ContainerController,
// Animated move position Top
container.move(type: .top)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// Remove the subviews ContainerController
container.remove()
container = nil
}
}
Action
Move position with an animation
container.move(type: .top)
container.move(type: .middle)
container.move(type: .bottom)
Adding possible custom subviews in ContainerController view
ScrollView
Add let tableView = UITableView()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.backgroundColor = .clear
tableView.tableFooterView = UIView()
tableView.delegate = self
tableView.dataSource = self
// Add scrollView to container
container.add(scrollView: tableView)
Delegate
to self 👆
self
, then you need to call 4 functions in ContainerController
If you implement delegate ScrollView (TableView, CollectionView, TextView) to extension ViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
container.scrollViewDidScroll(scrollView)
}
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
container.scrollViewWillBeginDragging(scrollView)
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
container.scrollViewDidEndDecelerating(scrollView)
}
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
container.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
}
}
extension ViewController: UITableViewDelegate {
...
}
extension ViewController: UITableViewDataSource {
...
}
HeaderView
Add let headerView = ExampleHeaderGripView()
headerView.height = 20
container.add(headerView: headerView)
FooterView
Add let tabBarView = HeaderTabBarView()
tabBarView.height = 49.0
container.add(footerView: tabBarView)
View
Add Custom // Add custom shadow
let layer = container.view.layer
layer.shadowOpacity = 0.5
layer.shadowColor = UIColor.red.cgColor
layer.shadowOffset = CGSize(width: 1, height: 4)
layer.shadowRadius = 5
// Add view in container.view
let viewRed = UIView(frame: CGRect(x: 50, y: 50, width: 50, height: 50))
viewRed.backgroundColor = .systemRed
container.view.addSubview(viewRed)
// Add view under scrollView container.view
let viewGreen = UIView(frame: CGRect(x: 25, y: 25, width: 50, height: 50))
viewGreen.backgroundColor = .systemGreen
container.view.insertSubview(viewGreen, at: 0)
Settings ⚙️
Layout
ContainerLayout
on initialization
Customize the layout with create subclass class NewContainerLayout: ContainerLayout {
override init() {
super.init()
// Initialization start position.
startPosition = .hide
// Disables any moving with gestures.
movingEnabled = true
// Sets the new value for positions of animated movement (top, middle, bottom).
positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
// Sets insets container.view (left, right).
insets = ContainerInsets(right: 20, left: 20)
}
}
class ViewController: UIViewController {
var container: ContainerController!
override func viewDidLoad() {
super.viewDidLoad()
container = ContainerController(addTo: self, layout: NewContainerLayout())
container.move(type: .top)
}
}
ContainerLayout
Or create object override func viewDidLoad() {
super.viewDidLoad()
// Create ContainerController Layout object
let layout = ContainerLayout()
layout.startPosition = .hide
layout.backgroundShadowShow = true
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
container = ContainerController(addTo: self, layout: layout)
}
Change settings right away
// Properties
container.set(movingEnabled: true)
container.set(trackingPosition: false)
container.set(footerPadding: 100)
// Add ScrollInsets Top/Bottom
container.set(scrollIndicatorTop: 5) // ↓
container.set(scrollIndicatorBottom: 5) // ↑
// Positions
container.set(top: 70) // ↓
container.set(middle: 250) // ↑
container.set(bottom: 80) // ↑
// Middle Enable/Disable
container.set(middle: 250)
container.set(middle: nil)
// Background Shadow
container.set(backgroundShadowShow: true)
// Insets View
container.set(left: 5) // →
container.set(right: 5) // ←
// Landscape params
container.setLandscape(top: 30)
container.setLandscape(middle: 150)
container.setLandscape(bottom: 70)
container.setLandscape(middle: nil)
container.setLandscape(backgroundShadowShow: false)
container.setLandscape(left: 10)
container.setLandscape(right: 100)
View
ContainerController Use a ready-made solution
ContainerView
is generated automatically when you create ContainerController
Use a ready-made solution to change the radius, add shadow, and blur.
CornerRadius
Change // Change cornerRadius global for all subviews
container.view.cornerRadius = 15
Shadow
Add Layer container.view.addShadow(opacity: 0.1)
Blur
Add Background // add blur UIVisualEffectView
container.view.addBlur(style: .dark)
More details
Change positions on screen Top Middle Bottom
// These parameters set the new position value.
container.layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
// Change settings right away
container.set(top: 70) // ↓
container.set(middle: 250) // ↑
container.set(bottom: 80) // ↑
Customize indentations for View
// Sets insets container.view (left, right).
container.layout.insets = ContainerInsets(right: 20, left: 20)
container.layout.landscapeInsets = ContainerInsets(right: 20, left: 100)
// Change settings right away
container.set(left: 5) // →
container.set(right: 5) // ←
container.setLandscape(left: 10)
container.setLandscape(right: 100)
Customize for landscape orientation
// Sets the background shadow under container. (Default: backgroundShadowShow).
container.layout.landscapeBackgroundShadowShow = false
// Sets the new value for positions of animated movement (top, middle, bottom). (Default: positions).
container.layout.landscapePositions = ContainerPosition(top: 20, middle: 150, bottom: 70)
// Sets insets container.view (left, right). (Default: insets).
container.layout.landscapeInsets = ContainerInsets(right: 20, left: 100)
// Change settings right away
container.setLandscape(top: 30)
container.setLandscape(middle: 150)
container.setLandscape(bottom: 70)
container.setLandscape(middle: nil)
container.setLandscape(backgroundShadowShow: false)
container.setLandscape(left: 10)
container.setLandscape(right: 100)
Parameters for control footerView
// Padding-top from container.view, if headerView is added, then its + height is summed.
container.layout.footerPadding = 100
// Tracking position container.view during animated movement.
container.layout.trackingPosition = false
// Change settings right away
container.set(footerPadding: 100)
container.set(trackingPosition: false)
Delegate
ContainerController class ViewController: UIViewController, ContainerControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let container = ContainerController(addTo: self, layout: layout)
container.delegate = self
}
}
/// Reports rotation and orientation changes
func containerControllerRotation(_ containerController: ContainerController) {
...
}
/// Reports a click on the background shadow
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) {
...
}
Author
License
ContainerController is available under the MIT license. See the LICENSE file for more info.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].