UIViewController extension to present view / view controller as bottom-half modal.

Related tags

Utility swift ios
Overview

CocoaPods SPM license

UIViewController extension to present view / view controller as bottom-half modal.

Installation

CocoaPods

pod 'SemiModalViewController'

Swift Package Manager

dependencies: [
    .Package(url: "https://github.com/muyexi/SemiModalViewController.git", majorVersion: 0)
]

Usage

Present a view controller:

let options = [
    SemiModalOption.pushParentBack: true
]

let controller = UIViewController()

controller.view.height = 200
controller.view.backgroundColor = UIColor.redColor()

presentSemiViewController(controller, options: options, completion: {
    print("Completed!")
}, dismissBlock: {
    print("Dismissed!")
})

Or view:

let view = UIView(frame: UIScreen.mainScreen().bounds)
view.height = 300
view.backgroundColor = UIColor.redColor()

presentSemiView(view, options: options) {
    print("Completed!")
}

Dismiss a presented view / view controller:

dismissSemiModalView()

Default options:

SemiModalOption.traverseParentHierarchy : true,
SemiModalOption.pushParentBack          : false,
SemiModalOption.animationDuration       : 0.5,
SemiModalOption.parentAlpha             : 0.5,
SemiModalOption.parentScale             : 0.8,
SemiModalOption.shadowOpacity           : 0.5,
SemiModalOption.transitionStyle         : .slideUp,
SemiModalOption.disableCancel           : true

Credits

SemiModalViewController is based on KNSemiModalViewController.

License

SemiModalViewController is released under the MIT license. See LICENSE for details.

You might also like...
Array diffs as collection view wants it - now in Swift ✨
Array diffs as collection view wants it - now in Swift ✨

Doppelganger-Swift Inspired by Doppelganger written in Swift Features Removes confusion from users when data changes Animates moving, inserting and de

Swift-HorizontalPickerView - Customizable horizontal picker view component written in Swift for UIKit/iOS

Horizontal Picker View Customizable horizontal picker view component written in

MarvelComics-ViewCode é um app  para fins de estudo, desenvolvido em Swift utilizando View Code.
MarvelComics-ViewCode é um app para fins de estudo, desenvolvido em Swift utilizando View Code.

MarvelComics-ViewCode - iOS O MarvelComics-ViewCode é um app para listar todos os personagens da Marvel, implementado em Swift utilizando View Code co

SwiftUI package to present a Bottom Sheet interactable view with the desired Detents. Also known as Half sheet.
SwiftUI package to present a Bottom Sheet interactable view with the desired Detents. Also known as Half sheet.

BottomSheetSUI BottomSheetSUI is a package that gives you the ability to show a Bottom sheet intractable, where you can add your own SwiftUI view. You

DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.
DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.

DrawerKit What is DrawerKit? DrawerKit is a custom view controller presentation mimicking the kind of behaviour in the Apple Maps app. It lets any vie

iOS simple project to create half-screen modal view controller with pan
iOS simple project to create half-screen modal view controller with pan

Simple Half-screen view controller, draggable and less code (learning purpose)

Simple way to set up half modal view
Simple way to set up half modal view

HalfModalView Requirements iOS 9.0+ Xcode 10.0+ Swift 4.0+ Example Installation CocoaPods is a dependency manager for Cocoa projects. You can install

Half modal view for SwiftUI
Half modal view for SwiftUI

ResizableSheet ResizableSheeet is a half modal view library for SwiftUI. You can easily implement a half modal view. Target Swift5.5 iOS14+ Installati

BottomSheetDemo - Bottom sheet modal view controller with swift
BottomSheetDemo - Bottom sheet modal view controller with swift

当我们想弹出一个预览视图,bottom sheet modal view controller 非常实用。在 iOS 中,长按拖拽手势可以让 controlle

UIViewController subclass to beautifully present news articles and blog posts.
UIViewController subclass to beautifully present news articles and blog posts.

LMArticleViewController This framework allows you to create Apple News-inspired UIViewControllers with ease. It is heavily inspired by MRArticleViewCo

HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.
HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.

HoverConversion ManiacDev.com referred. https://maniacdev.com/2016/09/hoverconversion-a-swift-ui-component-for-navigating-between-multiple-table-views

Swift UI Kit to present clean modal/alert
Swift UI Kit to present clean modal/alert

CleanyModal is a good way to use UI-Customised alerts with ease Features Present some kind of clean alerts (With same API as UIAlertViewController) Ad

Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer. Expandable bottomsheet. Slide out bottom menu
Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer. Expandable bottomsheet. Slide out bottom menu

Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer Features It does not re-render the background content while manipulating with the sheet iOS and

A modal passcode input and validation view controller for iOS
A modal passcode input and validation view controller for iOS

TOPasscodeViewController A modal passcode input and validation view controller for iOS. TOPasscodeViewController is an open-source UIViewController su

A modal passcode input and validation view controller for iOS
A modal passcode input and validation view controller for iOS

TOPasscodeViewController A modal passcode input and validation view controller for iOS. TOPasscodeViewController is an open-source UIViewController su

A custom modal transition that presents and dismiss a controller with an expanding bubble effect.
A custom modal transition that presents and dismiss a controller with an expanding bubble effect.

A custom modal transition that presents and dismiss a controller inside an expanding and shrinking bubble. Screenshot Usage Install through CocoaPods:

A custom modal transition that presents a controller with an expanding effect while sliding out the presenter remnants.
A custom modal transition that presents a controller with an expanding effect while sliding out the presenter remnants.

DAExpandAnimation A custom modal transition that presents a controller with an expanding effect while sliding out the presenter remnants. Screenshot I

Light and scrollable view controller for tvOS to present blocks of text
Light and scrollable view controller for tvOS to present blocks of text

TvOSTextViewer Light and scrollable view controller for tvOS to present blocks of text Description TvOSTextViewer is a view controller to present bloc

iOS custom controller used in Jobandtalent app to present new view controllers as cards
iOS custom controller used in Jobandtalent app to present new view controllers as cards

CardStackController iOS custom controller used in the Jobandtalent app to present new view controllers as cards. This controller behaves very similar

Comments
  • Screen flash

    Screen flash

    Hello!

    First of all i want to thank you for this library ^_^

    I've been using it for one of my projects and i saw that the screen flashes when i rotate the device and the semiModalView is open (i locked the app to be used in portrait mode only).

    Any idea of how to avoid this flash?

    Thanks and best regards!

    opened by llKoull 8
  • fix some issue

    fix some issue

    1. let childViewController can use dismissSemiModalView function
    2. before get saved options, check option data type is match
    3. reduce use swift unconditional unwrapping(!), sometimes will crash
    4. objc_setAssociatedObject save in targetVC or rootVc , because when call dismissSemiModalView in the childViewController, it can not get semiModalViewController and semiModalDismissBlock
    opened by tentenlee100 1
  • Carthage Support

    Carthage Support

    I would love to see for this package Carthage support or SPM support. Is there any chance that this could be realized? I could help to build this support.

    opened by armintelker 0
  • Option do not screenshot

    Option do not screenshot

    Hey it would be nice to have an option to not screenshot the parent. In my case the parent is changing in the background on actions that are done in my child ModalViewController.

    https://github.com/muyexi/SemiModalViewController/blob/894189df91eac7ecc743b8cef6758c1be28687a7/Source/UIViewController%2BSemiModalViewController.swift#L76:L81

    opened by armintelker 0
Releases(1.0.0)
Owner
Winter
Lifelong learner
Winter
BCSwiftTor - Opinionated pure Swift controller for Tor, including full support for Swift 5.5 and Swift Concurrency

BCSwiftTor Opinionated pure Swift controller for Tor, including full support for

Blockchain Commons, LLC — A “not-for-profit” benefit corporation 4 Oct 6, 2022
An iOS app/Safari extension to automagically redirect AMP links to their normal counterpart. Comes with a trusty dog.

Amplosion ⚡️ Amplosion is an iOS 15 and greater app that automagically redirects AMP links to their normal counterpart. AMP links can be super annoyin

Christian Selig 46 Dec 11, 2022
YMExtension - Swift extension

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

刘彦铭 0 Nov 26, 2021
An extension for Xcode to generate builders from structs

Swift Struct Builder Generator Xcode Source Editor Extension An Xcode extension (plugin) to generate struct builders automatically. Install Swift Stru

Marius Wichtner 1 Nov 24, 2021
Unboxing - An extension for KeyedDecodingContainer class to decode a collection of heterogeneous types.

Unboxing An extension for KeyedDecodingContainer class to decode a collection of heterogeneous types. Usage Start by creating an enum that has variant

null 2 Jun 15, 2022
SwiftExtensionKit - SwiftExtensionKit is to contain generic extension helpers for UIKit and Foundation

RichAppz PureSwiftExtensionKit SwiftExtensionKit is to contain generic extension

Rich Mucha 0 Jan 31, 2022
A lightweight extension to Swift's CollectionDifference, supporting moves in addition to removals and insertions, critical when updating interfaces and managing reference types.

DifferenceTracker is a lightweight extension to Swift's CollectionDifference. It defines moves in addition to removals and insertions, critical when updating interfaces and managing reference types.

Giles Hammond 2 Nov 25, 2022
iOS ReplayKit Screen Share Broadcast Extension Frame Sharing

An iOS app that demonstrates how we can share CMSampleBuffer frames from SampleHandler of Broadcast Extension to the host app and how to pass callbacks to and fro from host app to SampleHandler and vice versa.

IOTric 5 Oct 15, 2022
A CMIO Camera Extension of the creative camera type, with configuration app

ArtFilm A CMIO Camera Extension of the creative camera type, with configuration app ArtFilm is the sample code for the blog post Getting To Grips With

Halle 7 Jan 1, 2023
Using UI Table View With Swift

News-App - Apple 관련 기사를 보여주는 News app을 만들 것입니다. - 자세한 과정은 리드미에 있습니다. Table View와 Table view controller Table View : Table의 크기를 지정할 수 있다. Table View Co

Jiwon 0 Dec 9, 2021