All Projects → rishi420 → Bonsai

rishi420 / Bonsai

Licence: MIT license
🌲 Bonsai makes your view controller custom size.

Programming Languages

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

Projects that are alternatives of or similar to Bonsai

react-spring-bottom-sheet
Accessible ♿️, Delightful ✨, & Fast 🚀
Stars: ✭ 604 (+858.73%)
Mutual labels:  popup
Xamarin-Forms-Popup-Demo
Sample Xamarin Forms app for using Popups
Stars: ✭ 20 (-68.25%)
Mutual labels:  popup
fuckfuckadblock
Filters for blocking pop-ups and anti-adblock bypass.
Stars: ✭ 983 (+1460.32%)
Mutual labels:  popup
vue-modal
A customizable, stackable, and lightweight modal component for Vue.
Stars: ✭ 96 (+52.38%)
Mutual labels:  popup
ToolTipPopupWordTV
ToolTipopupWordTV is an Open Source Android library that allows developers to easily open a popup with details by select a word from a textview.
Stars: ✭ 41 (-34.92%)
Mutual labels:  popup
eins-modal
Simple to use modal / alert / dialog / popup. Created with pure JS. No javascript knowledge required! Works on every browser and device! IE9
Stars: ✭ 30 (-52.38%)
Mutual labels:  popup
vercel-toast
💬 Framework-agnostic vercel design's toast component (≈1KB Gzipped)
Stars: ✭ 67 (+6.35%)
Mutual labels:  popup
MaterialDesign-Toast
Custom android Toast with Material Design
Stars: ✭ 70 (+11.11%)
Mutual labels:  popup
nativescript-menu
A plugin that adds a pop-up menu to NativeScript
Stars: ✭ 17 (-73.02%)
Mutual labels:  popup
SKChoosePopView
SKChoosePopView是一个HUD风格的可定制化选项弹窗的快速解决方案,集成了上、下、左、右、中5个进场方向的6种动画效果,如果不能满足你对酷炫效果的需要,SKChoosePopView同样支持自定义动画,以及选择记录、动画的开闭、点击特效、行列数量控制等
Stars: ✭ 70 (+11.11%)
Mutual labels:  popup
prophetjs
Vanilla JS library to display toast messages.
Stars: ✭ 31 (-50.79%)
Mutual labels:  popup
vue-dialog
A drag-able dialog for Vue.js
Stars: ✭ 21 (-66.67%)
Mutual labels:  popup
Ambar-Xamarin
A macOS Menu Bar app built with Xamarin and C#
Stars: ✭ 63 (+0%)
Mutual labels:  popup
PopItUp
a Popup system for iOS
Stars: ✭ 26 (-58.73%)
Mutual labels:  popup
react-redux-modal-flex
[DEPRECATED] Make easy a modal/popup with Redux
Stars: ✭ 14 (-77.78%)
Mutual labels:  popup
FindTheStupidWindow
Windows API hooking project to log all the windows / UIs with the exact timestamp when they are opened.
Stars: ✭ 13 (-79.37%)
Mutual labels:  popup
CoinHive
A nice friendly simple and easly customizable GUI for coinhives javascript miner to embed onto websites so users of your site can interact with features of the miner on every single page this javascript miner is to help those who have problems with advertisements/advertising/ads popups banners mobile redirects malvertising/malware etc and provid…
Stars: ✭ 58 (-7.94%)
Mutual labels:  popup
corner-popup
jQuery pop-up script displaying various types of content in corner of browser
Stars: ✭ 23 (-63.49%)
Mutual labels:  popup
Customized-Popup
Customized popup provides you independency related to how you want to show a popup according to your UX.
Stars: ✭ 13 (-79.37%)
Mutual labels:  popup
rn-circle-quick-actions
React Native library to display a modal popup quick actions menu
Stars: ✭ 41 (-34.92%)
Mutual labels:  popup

Bonsai

Version License Platform

🌲 Bonsai makes iOS View Controller present modally in any size and any position with cool transition animation.

Bonsai

Features

  • Makes view controller appear as
    • Popup alert (no dismiss on tap outside)
    • Notification alert (auto dismiss after delay)
    • Side menu (drawer)
  • Transition animation
    • Slide In from left, right, top and bottom
    • Bubble pop from an initial frame or a view
  • Blur effect on background
    • light, dark, regular, prominent
  • Supports Storyboard and Code
  • Supports landscape and portrait orientation
  • Created with Swift compatible with Objective-C
  • Preserves Safe Area and Auto Layout constraints

Installation with CocoaPods

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

use_frameworks!
pod 'BonsaiController'

Install Manually

Drag the ~/BonsaiController directory anywhere in your project.

How to use

import BonsaiController

Add (copy paste) BonsaiControllerDelegate extension to your view controller

extension YourViewController: BonsaiControllerDelegate {
    
    // return the frame of your Bonsai View Controller
    func frameOfPresentedView(in containerViewFrame: CGRect) -> CGRect {
        
        return CGRect(origin: CGPoint(x: 0, y: containerViewFrame.height / 4), size: CGSize(width: containerViewFrame.width, height: containerViewFrame.height / (4/3)))
    }
    
    // return a Bonsai Controller with SlideIn or Bubble transition animator
    func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
    
        /// With Background Color ///
    
        // Slide animation from .left, .right, .top, .bottom
        return BonsaiController(fromDirection: .bottom, backgroundColor: UIColor(white: 0, alpha: 0.5), presentedViewController: presented, delegate: self)
        
        // or Bubble animation initiated from a view
        //return BonsaiController(fromView: yourOriginView, backgroundColor: UIColor(white: 0, alpha: 0.5), presentedViewController: presented, delegate: self)
    
    
        /// With Blur Style ///
        
        // Slide animation from .left, .right, .top, .bottom
        //return BonsaiController(fromDirection: .bottom, blurEffectStyle: .light, presentedViewController: presented, delegate: self)
        
        // or Bubble animation initiated from a view
        //return BonsaiController(fromView: yourOriginView, blurEffectStyle: .dark,  presentedViewController: presented, delegate: self)
    }
}

How to present the view controller

From Code:

let smallVC = YourViewController() // instantiateViewController(withIdentifier:)
smallVC.transitioningDelegate = self
smallVC.modalPresentationStyle = .custom
present(smallVC, animated: true, completion: nil)

From Storyboard:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

    if segue.destination is YourViewController {
        segue.destination.transitioningDelegate = self
        segue.destination.modalPresentationStyle = .custom
    }
}

Customize

Auto dismiss after delay

let bonsaiController = BonsaiController(...
bonsaiController.perform(#selector(bonsaiController.dismiss), with: nil, afterDelay: 2)

Customizable properties (Default values)

bonsaiController.springWithDamping = 0.8
bonsaiController.duration = 0.4
bonsaiController.isDisabledTapOutside = false
bonsaiController.isDisabledDismissAnimation = false
bonsaiController.dismissDirection = nil // Reverse direction. Availabel only for slide in transition.

Custom transition animation

If you want to create your own transition animation, implement this protocol in your viewController

extension YourViewController: UIViewControllerTransitioningDelegate {

    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        // Your presentation animation hear
    }

    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        // Your dismiss animation here
    }
}

Usage In Objective-C

#import "YourModuleName-Swift.h"  // only if project created in swift

@import BonsaiController;

Add (copy paste) BonsaiControllerDelegate extension to your view controller

// MARK:- Bonsai Controller Delegate
- (CGRect)frameOfPresentedViewIn:(CGRect)containerViewFrame {

    return CGRectMake(0, containerViewFrame.size.height / 4, containerViewFrame.size.width, containerViewFrame.size.height / (4.0 / 3.0));
}

- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source {

    // Slide animation from .left, .right, .top, .bottom
    //return [[BonsaiController alloc] initFromDirection:DirectionBottom blurEffectStyle:UIBlurEffectStyleLight presentedViewController:presented delegate:self];

    // or Bubble animation initiated from a view
    return [[BonsaiController alloc] initFromView:self.exampleButton blurEffectStyle:UIBlurEffectStyleDark presentedViewController:presented delegate:self];
}

How to present the view controller(obj-c)

From Code:

SmallViewController *smallVC = [self.storyboard instantiateViewControllerWithIdentifier:@"SmallVC"];
smallVC.transitioningDelegate = self;
smallVC.modalPresentationStyle = UIModalPresentationCustom;
[self presentViewController:smallVC animated:true completion:nil];

From Storyboard:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([segue.destinationViewController isKindOfClass:SmallViewController.class]) {
        segue.destinationViewController.transitioningDelegate = self;
        segue.destinationViewController.modalPresentationStyle = UIModalPresentationCustom;
    }
}

Example

An example project is included with this repo. To run the example project, clone the repo, and run pod install from the Example directory first.

Minimum Requirements

  • Xcode 10.2 with swift5 (check previous releases and pod versions for older xcode)
  • iOS 9.3

Your input is welcome!

If you have any suggestions, please get in touch with us.
If you need help or found a bug, please open an issue.
If you have a new transition animation or want to contribute, please submit a pull request.

Let us know!

If you like BonsaiController, give it a ★ at the top right of this page.
Using BonsaiController in your app? Send us a link to your app in the app store!

Credits

Thank You

A special thank you to everyone that has contributed to this library to make it better. Your support is appreciated!

Author

Developer: Warif Akhand Rishi, [email protected]
Designer: Takmila Tasmim Mim, [email protected]

License

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

Support Us

Buy Me A Coffee

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