All Projects → di2pra → D2PCurvedModal

di2pra / D2PCurvedModal

Licence: MIT License
An elegant and curved modal View for iOS (Swift)

Programming Languages

swift
15916 projects
shell
77523 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to D2PCurvedModal

react-gallery-carousel
Mobile-friendly gallery carousel 🎠 with server side rendering, lazy loading, fullscreen, thumbnails, touch, mouse emulation, RTL, keyboard navigation and customisations.
Stars: ✭ 178 (+201.69%)
Mutual labels:  modal
MobileQA
离线端阅读理解应用 QA for mobile, Android & iPhone
Stars: ✭ 49 (-16.95%)
Mutual labels:  iphone
Circular Buffer
Circular Buffer/ Circular Array
Stars: ✭ 16 (-72.88%)
Mutual labels:  circular
angular-super-gallery
AngularJS super image gallery
Stars: ✭ 46 (-22.03%)
Mutual labels:  modal
radiaSlider
circular/linear knob-style slider
Stars: ✭ 18 (-69.49%)
Mutual labels:  circular
SpecTools
Write less test code with this set of spec tools. Swift, iOS, testing framework independent (but works well with Quick/Nimble or directly).
Stars: ✭ 38 (-35.59%)
Mutual labels:  iphone
blobile
Blases Loaded - Unofficial Live Blaseball Game Viewer for iOS, Android, and Web
Stars: ✭ 16 (-72.88%)
Mutual labels:  iphone
gidevice
communicate with iOS devices implemented with Golang
Stars: ✭ 156 (+164.41%)
Mutual labels:  iphone
Deviice
Swift library to easily check the current device and some more info about it.
Stars: ✭ 51 (-13.56%)
Mutual labels:  iphone
Cirque
An iOS component that enables you to draw multi color circle strokes with gradient trasitions between colors
Stars: ✭ 23 (-61.02%)
Mutual labels:  circular
Shinobu
iOS remote application written in Swift to control a MPD server.
Stars: ✭ 31 (-47.46%)
Mutual labels:  iphone
ng-sq-ui
Flexible and easily customizable UI-kit for Angular 11+
Stars: ✭ 99 (+67.8%)
Mutual labels:  modal
react-native-awesome-alert
🔔 Customizable modal components with ✔️check options in React Native
Stars: ✭ 50 (-15.25%)
Mutual labels:  modal
nglp-angular-material-landing-page
NGLP is an Angular Material Landing Page.
Stars: ✭ 32 (-45.76%)
Mutual labels:  modal
socket-chat
This project will help you build a chat app by using the Socket IO library.
Stars: ✭ 36 (-38.98%)
Mutual labels:  iphone
iosvpn.github.io
iPhone和iOS 翻墙梯子VPN推荐,2022中国苹果手机iPhone翻墙软件和科学上网避坑指南,稳定梯子推荐。
Stars: ✭ 72 (+22.03%)
Mutual labels:  iphone
rn-circular-slider
React Native circular slider based on react-native-svg
Stars: ✭ 25 (-57.63%)
Mutual labels:  circular
LCAuthManager
一个简单、高效、易用的权限验证库,包括手势密码、Touch ID和Face ID;A comprehensive, efficient and easy-to-use rights verification library, including Gesture Password, Touch ID and Face ID.
Stars: ✭ 28 (-52.54%)
Mutual labels:  iphone
SBCardPopup
Card Popup UI for iOS
Stars: ✭ 66 (+11.86%)
Mutual labels:  modal
react-svg-curve
React components to draw different types of curves with svg
Stars: ✭ 42 (-28.81%)
Mutual labels:  curve

D2PCurvedModal

CI Status Version License Platform

   
Demo Gif Screenshot 1Screenshot 2

Example

To run the example project, clone the repo, and run pod install from the Example directory first. The Example project use the modal as a Color/Size Picker.

Installation

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

pod 'D2PCurvedModal'

How to Use?

  1. First install the Pod and import the module D2PCurvedModal to your file
import D2PCurvedModal
  1. Instantiate D2PCurvedModalTransition and D2PCurvedModalPercentDrivenTransition inside the your presenting ViewController
let percentDrivenTransition = D2PCurvedModalPercentDrivenTransition()
let transition = D2PCurvedModalTransition()
  1. For the purpose of the transition animation your presenting ViewController must conform the UIViewControllerTransitioningDelegate protocol, with these appropriate methods
extension ViewController: UIViewControllerTransitioningDelegate {
    
    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
       
        if presented is D2PCurvedModal {
            transition.opening = true
            return transition
        }
        
        return nil
        
    }
    
    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        
        if dismissed is D2PCurvedModal {
            transition.opening = false
            return transition
        }
        
        return nil
        
        
    }
    
    func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
        
        return percentDrivenTransition.transitionInProgress ? percentDrivenTransition : nil
        
    }
    
}
  1. Inside the action method (to open the modal) instantiate the view controllers that will appear embedded into the D2PCurvedModal and instantiate D2PCurvedModal, to finally use the method setUpViewOf(viewController:) of D2PCurvedModal
@IBAction func openModal(_ sender: Any) {

    let myCustomVC = MyCustomVC(nibName: "MyCustomVC", bundle: Bundle(for: MyCustomVC.self))
    let modalVC = D2PCurvedModal(nibName: "D2PCurvedModal", bundle: Bundle(for: D2PCurvedModal.self))
 
    modalVC.setUpViewOf(viewController: myCustomVC)
 
    modalVC.containerHeight = 200
    modalVC.transitioningDelegate = self
    percentDrivenTransition.attachToViewController(viewController: modalVC)
 
    present(modalVC, animated: true, completion: nil)
 
}

That's it! You're all set!!

Documentation

All of the methods and properties available for D2PCurvedModal are documented below.

Change the modal container height

The containerHeight Property (CGFloat) (Default: 300)

Use the containerHeight property of D2PCurvedModal to change the height of the container view. Example usage:

 modalVC.containerHeight = 200

Change the modal background color

The bgColor Property (UIColor) (Default: .white)

Use the bgColor property of D2PCurvedModal to change the background color of the modal view. Example usage:

 modalVC.bgColor = .orange

Change the modal title

The modalTitle Property (String) (Default: "")

Use the modalTitle property of D2PCurvedModal to change the title of the modal. Example usage:

 modalVC.modalTitle = "Filter"

Change the modal title color

The modalTitleColor Property (UIColor) (Default: .lightGray)

Use the modalTitleColor property of D2PCurvedModal to change the title text color.

Change the close button background color

The closeBtnBgColor Property (UIColor) (Default: #FD4741)

Use the closeBtnBgColor property of D2PCurvedModal to change the background color of the modal close button.

Change the close button tint color

The closeBtnTintColor Property (UIColor) (Default: .white)

Use the closeBtnTintColor property of D2PCurvedModal to change the tint color of the modal close button.

Access the container view controller

The containerVC Property (UIViewController)

Use the containerVC property of D2PCurvedModal to access the view controller of the view that is embedded into the D2PCurvedModal.

Manually close the modal view

The close(animated: Bool, completion: (() -> Void)?) method

Use the close method of D2PCurvedModal to manually close the modal.

Delegate

D2PCurvedModal uses a delegate to receive modal change events. The delegate object must conform to the D2PCurvedModalDelegate protocol, which is composed of the method:

  • modalWillOpen(modalVC: D2PCurvedModal)
    Tells the delegate that the view of the specified modal view controller is about to be displayed.

  • modalWillClose(modalVC: D2PCurvedModal)
    Tells the delegate that the view of the specified modal view controller is about to be removed.

Requirements

No Requirement

Author

Di2pra LinkedIn

Credits

Credits to Johny Vino for the UI Design inspiration. FlatIcon for the icons.

License

D2PCurvedModal 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].