Latest 0.4.0.6
Homepage https://github.com/ali59a/DraggableDynamicModal
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Welcome to DraggableDynamicModal

DraggableDynamicModal is a library for revealing a view controller from the bottom with custom UI and custom gestures, offering a great animation and user interactions.

Just slide your hand to close the view when it’s opened.

Getting started

To use this library, you should follow these steps. I will explain three different cases. But, let start by requirements.

Requirements

To use the modal view, start by importing the module :

import DraggableDynamicModal

To create an easy draggable view controller, you should instantiate a ModalViewControllerManager.

var modalManager: ModalViewControllerManager!

The ModalViewControllerManager ‘s initializer takes one required parameter, the parentViewController, in charge of presenting the child modal, and two optional parameters, shouldTransformBehindView and backgroundBlurredView.

  1. shouldTransformBehindView is a boolean: If the value is true then the parent view will be scaled to 90% instead of 100%, otherwise the amount still on 100%.
  2. backgroundBlurredView is a boolean: If the value is true then a view will be inserted on the background.

Presenting

To present a child view controller, ensure that this child conforms to the protocol: DraggableChildModal

The protocol look likes :

public protocol DraggableChildModal: class {
    var childHeight: CGFloat? { get }
    var shouldBeDragable: Bool { get }
    var topCornerRadius: CGFloat? { get }
    var padding: UIEdgeInsets? { get }
    var animationDuration: CGFloat { get }
}

Case 1: A view controller without a scroll view

Just create a view controller conforms to DraggableChildModal and use the ModalViewControllerManager instance to present it.

Case 2: A view controller with scroll view (inside view controller of inside a child view controller)

Just create a view controller conforms to DraggableChildModal and use the ModalViewControllerManager instance to present it. But, tag the view controller in your code to : ModalViewControllerManager.ModalViewControllerManagerScrollViewTag

The library detect the scrollview and handle It.

Case 4: A navigation controller when every child has it’s own UI configuration

If you would like to present a navigation controller and change the UI every time that a child is pushed, just make your navigation controller inherit from DraggableModalNavigationViewController

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

DraggableDynamicModal is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "DraggableDynamicModal"

Author

ali59a, [email protected]

License

DraggableDynamicModal is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DraggableDynamicModal",
    "version": "0.4.0.6",
    "summary": "This library allows to facilitate the display of a view controller as modal with great animation and user interaction.n                         You can easily change the child in this modal as well as the size.",
    "description": "To create a modal manager you should create a `ModalViewControllerManager` :n```nvar modalManager: ModalViewControllerManager!nself.modalManager = ModalViewControllerManager(parentViewController: {The parent who oresenting the modal controller}})n```nnThen, you can present the modal using the method : `presentModal`. This method takes only on parameters, the view controller to display.nnThe view controller to be displayed should be conform to `DraggableChildModal` and implement the method `shouldChangeContainerHeight`",
    "homepage": "https://github.com/ali59a/DraggableDynamicModal",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ali59a": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ali59a/DraggableDynamicModal.git",
        "tag": "0.4.0.6"
    },
    "social_media_url": "https://twitter.com/ali59a",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": [
        "DraggableDynamicModal/Classes/Core/*.{Swift}",
        "DraggableDynamicModal/Classes/ViewControllers/*.{Swift}",
        "DraggableDynamicModal/Classes/Utils/*.{h,m}"
    ],
    "resource_bundles": {
        "DraggableDynamicModal": [
            "DraggableDynamicModal/Classes/*.{storyboard}"
        ]
    },
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This