Custom transition between controllers. Settings controller for your iOS app.

Overview

SPLarkController

About

Transition between controllers to top. You can change animatable height after presentation controller.

For presentation and dismissing using custom transition delegate.

You can set any content to bottom controller, like buttons or even collection as in preview. For implement settings as in preiew, see section Settings Controller.

If you like the project, don't forget to put star ★
Check out my other libraries:

Navigate

Requirements

Swift 4.2 & 5.0. Ready for use on iOS 10+

Installation

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

To integrate using Xcode 12, specify it in File > Swift Packages > Add Package Dependency...:

https://github.com/ivanvorobei/SPLarkController

CocoaPods:

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile:

pod 'SPLarkController'

Manually

If you prefer not to use any of dependency managers, you can integrate manually. Put Sources/ProjectName folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.

Usage

Presenting

Create controller and call func presentAsLark:

import UIKit
import SPLarkController

class ViewController: UIViewController {
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)

        let controller = UIViewController()
        self.presentAsLark(controller)
    }
}

If you want customize controller (set custom height and other), create controller and set transitioningDelegate to SPLarkTransitioningDelegate object. Use present or dismiss functions:

let controller = UIViewController()
let transitionDelegate = SPLarkTransitioningDelegate()
controller.transitioningDelegate = transitionDelegate
controller.modalPresentationStyle = .custom
controller.modalPresentationCapturesStatusBarAppearance = true
self.present(controller, animated: true, completion: nil)

Please, do not init SPLarkTransitioningDelegate like this:

controller.transitioningDelegate = SPLarkTransitioningDelegate()

You will get an error about weak property.

Height

Parameter customHeight sets custom height for modal controller. Default is nil:

transitionDelegate.customHeight = 350

Change Height

For change height after presenting use with code:

if let presentationController = self.presentationController as? SPLarkPresentationController {
    presentationController.updateHeight(600)
}

You can see how it work in Example folder. I am plase ready-use project.

Settings Controller

You can simple implement settings controller as in preview. You need extend from SPLarkSettingsController and implement all methods for it. See class for more details.

class SettingsController: SPLarkSettingsController {}

Snapshots

The project uses a snapshot of the screen in order to avoid compatibility and customisation issues. Before controller presentation, a snapshot of the parent view is made, and size and position are changed for the snapshot. Sometimes you will need to update the screenshot of the parent view, for that use static func:

SPLarkController.updatePresentingController(modal: controller)

and pass the controller, which is modal and uses SPLarkTransitioningDelegate

Modal presentation of other controller

If you want to present modal controller on SPLarkController, please set:

controller.modalPresentationStyle = .custom

It’s needed for correct presentation and dismissal of all modal controllers.

Other Projects

I love being helpful. Here I have provided a list of libraries that I keep up to date. For see video previews of libraries without install open opensource.ivanvorobei.by website.
I have libraries with native interface and managing permissions. Also available pack of useful extensions for boost your development process.

Russian Community

Подписывайся в телеграмм-канал, если хочешь получать уведомления о новых туториалах.
Со сложными и непонятными задачами помогут в чате.

Видео-туториалы выклыдываю на YouTube:

Tutorials on YouTube

Comments
  • Any way to change height after presenting?

    Any way to change height after presenting?

    Although this is not part of the current implementation, would you have any suggestions on how to change the view controller's height after it has been presented?

    An example use case for this behavior would be a settings view controller with a textfield which moves up when the keyboard appears.

    enhancement 
    opened by danielVebman 11
  • update parent controller

    update parent controller

    hi sir i go the lark controller with press a button and in lark controller i type a text in text field and then i press a button and i want send my text to parent controller when i back to parent controller nothings changed whats my problem ? here is my code thanks `import UIKit import SPLarkController class ViewController: UIViewController {

    @IBOutlet weak var labelResult: UILabel!
    internal var  labelText = ""
    @IBAction func goToLarkController(_ sender: Any) {
        
        let vc = storyboard?.instantiateViewController(withIdentifier: "ViewController2")
        let transitionDelegate = SPLarkTransitioningDelegate()
        vc?.transitioningDelegate = transitionDelegate
        vc?.modalPresentationStyle = .custom
        vc?.modalPresentationCapturesStatusBarAppearance = true
        self.present(vc!, animated: true, completion: nil)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        labelResult.text = labelText
        
    }}`
    

    `import UIKit import SPLarkController class ViewController2: UIViewController {

    @IBOutlet weak var t: UITextField!
    @IBAction func act(_ sender: UIButton) {
        let backToMainController = storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
        backToMainController.labelText = t.text!
        let transitionDelegate = SPLarkTransitioningDelegate()
        backToMainController.transitioningDelegate = transitionDelegate
        dismiss(animated: true, completion: nil)
        SPLarkController.updatePresentingController(modal: backToMainController)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
    }
    

    }`

    opened by miladswift 9
  • Some classes need to be public to work in SPM

    Some classes need to be public to work in SPM

    When using your code (which is great) with SwiftPackageManger, some Classes can not be accessed (like SPLarkPresentationController).

    Think they need marked as public to be available in the package.

    opened by grizzly 4
  • Issue with Swift Package Manager support

    Issue with Swift Package Manager support

    Big thanks for this beautiful library! Unfortunately I cannot get it to install via SPM, I get the error saying Source files for target SPLark should be located under 'Sources/SPLark', or a custom sources path can be set with the 'path' property in Package.swift

    Zrzut ekranu 2020-06-4 o 21 54 52
    opened by wiencheck 4
  • Modified method for updating the snapshot so it can be animated

    Modified method for updating the snapshot so it can be animated

    Modified method for updating the snapshot so it can be animated. It's useful when SPLark controller is used as a tab switcher, I've attached a gif showing the difference:

    Not animated: Not animated

    Animated: Animated

    opened by wiencheck 3
  • Custom height for Lark presenter doesn't actually make the sub VC same height as custom height

    Custom height for Lark presenter doesn't actually make the sub VC same height as custom height

    Hi, been trying to use this library to present one of my own custom VCs but I can't work out why the height of the presented view controller using lark doesn't have the same height as the custom height provided to the transition delegate. For example, ive told the delegate to be half the screen size which works for the transition but the view controller that is presented is still the same height as the screen height. This means that any views pinned to the bottom of the safe area for example are missing when using Lark.

    in this screen shot, you can see that the pink button is cut off even though it is constrained to be centre vertical and centre horizontal. IMG_1852

    Is there anyway to force the presented view controller's frame to match the frame of the lark transition? I've tried messing with the code in the library and can't seem to get it to work. I've noticed that frameOfPresentedViewInContainerView method never gets called in the presentation controller. override var frameOfPresentedViewInContainerView: CGRect { guard let containerView = containerView else { return .zero } print("frameOfPresentedViewInContainerView") return CGRect(x: 0, y: containerView.bounds.height - self.height, width: containerView.bounds.width, height: self.height) }

    bug 
    opened by Kohdepitcher 3
  • Example project not compiling

    Example project not compiling

    1. Build input file cannot be found: TestSwiftUIView.swift

    Beside that:

    1. let controller = viewCtrl ?!

    2. self.button.addTarget(self, action: #selector(self.presentLarkController), for: .touchUpInside) Selector calling iOS 13.0+ available method needs to be in #available check as well.

    opened by marko-cancar 2
  • Round snapshot view corners

    Round snapshot view corners

    Hi, thanks for beautiful library! Is there a way to round snapshot view corners for this case? My main view consists of tab bar + scroll view.

    image

    Thanks in advance.

    opened by edw4rddx 1
  • refresh parent.

    refresh parent.

    Hello, after i dismiss i want to refresh the parent controller. But it does not work.

    let controller = UIViewAcknoledge() controller.modalPresentationStyle = .custom SPLarkController.updatePresentingController(modal: controller) self.presentAsLark(controller)

    opened by ciumexan 1
  • Update for Swift 5

    Update for Swift 5

    Lib won't compile because of few changes needed.

    Can't even access customHeight property (Fixed in this commit) Because of -- 'customHeight' is inaccessable due to 'internal' protection level -- error

    opened by rico237 1
  • Removed two warnings caused under iOS 13.0

    Removed two warnings caused under iOS 13.0

    Goal

    This PR removed two warnings caused under iOS 13.0:

    'keyWindow' was deprecated in iOS 13.0: Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes

    Checklist

    • [x] Testing in iOS
    • [x] Installed correct via Swift Package Manager and Cocoapods
    opened by elilien 0
  • iOS 15 - Presented view controller appears briefly in front of the snapshot before transition

    iOS 15 - Presented view controller appears briefly in front of the snapshot before transition

    Coming back to this library to give it another go in a project but I noticed a visual bug with the presentation as it briefly flashes the target view controller in front of the snapshot before the snapshot animates up to reveal the underlying view controller.

    I've attached a video of the bug in the simulator when showing the destination view controller. Note that it doesn't happen all the time and also happens on a physical device.

    https://user-images.githubusercontent.com/15321325/168462778-3d550a61-0799-4ae5-b8c7-b0d2fba488f0.mp4

    Here is the code that I'm using to present the view controller: let transitionDelegate = SPLarkTransitioningDelegate() transitionDelegate.customHeight = self.view.frame.height * 0.60 palleteVC.transitioningDelegate = transitionDelegate palleteVC.modalPresentationStyle = .custom palleteVC.modalPresentationCapturesStatusBarAppearance = true

    self.present(palleteVC, animated: true, completion: nil)

    This never happened when I tried out this library for another project back in 2019. Not sure if its the UIHostingViewController that is being presented or if its something to do with iOS 15

    Thanks!

    opened by Kohdepitcher 0
Releases(1.2.1)
Owner
Ivan Vorobei
iOS Developer
Ivan Vorobei
XLPagerTabStrip is a Container View Controller that allows us to switch easily among a collection of view controllers

XLPagerTabStrip is a Container View Controller that allows us to switch easily among a collection of view controllers. Pan gesture can be used to move on to next or previous view controller. It shows a interactive indicator of the current, previous, next child view controllers.

xmartlabs 6.8k Dec 27, 2022
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
📷A simple and convenient way to manage your webcam's picture settings, right from your menu bar

Viewfinder A simple and convenient way to manage your webcam's picture settings, right from your menu bar. About • Download • Building from Source • C

Lukas Romsicki 31 Dec 25, 2022
Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As

Anatoliy Voropay 22 Dec 27, 2022
Interactive view transition to display menus with flowing and bouncing effects in Swift

FlowingMenu FlowingMenu provides an interactive transition manager to display menu with a flowing and bouncing effects. The Objective-C countepart is

Yannick Loriot 975 Dec 21, 2022
A side menu controller written in Swift for iOS

Description SideMenuController is a custom container view controller written in Swift which will display the main content within a center panel and th

Teo 1.2k Dec 29, 2022
A fun, easy-to-use tab bar navigation controller for iOS.

CircleBar Don’t you, sometimes, miss fun user interfaces? Truth is, we do. Sure, you can't use them in enterprise apps for obvious reasons, but if you

softhaus 786 Dec 25, 2022
iOS Slide Menu Controller. It is written in pure swift.

SlideMenuController Requirements iOS 9+ Installation SlideMenuController is available through CocoaPods. To install it, simply add the following line

Myung gi son 40 Jan 16, 2022
BottomSheet lets you add custom bottom sheets to your SwiftUI apps.

BottomSheet lets you add custom bottom sheets to your SwiftUI apps.

Daniel Saidi 174 Jan 2, 2023
Drawer view controller that easy to use!

KWDrawerController Drawer view controller that is easy to use! Installation CocoaPods (iOS 8+ projects) KWDrawerController is available on CocoaPods.

Jungwon An 157 Jun 14, 2022
A paging view controller with a highly customizable menu ✨

Getting Started | Customization | Installation Features Parchment lets you page between view controllers while showing any type of generic indicator t

Martin Rechsteiner 3k Jan 8, 2023
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

Tung Vo 290 Nov 13, 2022
Drawer view controller that easy to use!

KWDrawerController Drawer view controller that is easy to use! Installation CocoaPods (iOS 8+ projects) KWDrawerController is available on CocoaPods.

Jungwon An 157 Jun 14, 2022
RadialMenu is a custom control for providing a touch context menu (like iMessage recording in iOS 8) built with Swift & POP

RadialMenu Looking for help? For $150/hr I'll help with your RadialMenu problems including integrating it into your project. Email [email protected] t

Brad Jasper 297 Nov 27, 2022
RadialMenu is a custom control for providing a touch context menu (like iMessage recording in iOS 8) built with Swift & POP

RadialMenu Looking for help? For $150/hr I'll help with your RadialMenu problems including integrating it into your project. Email [email protected] t

Brad Jasper 297 Nov 27, 2022
A custom SwiftUI modifier to present an ActionSheet or a Popover menu

ActionOver A custom SwiftUI modifier to present an Action Sheet on iPhone and a Popover on iPad and Mac. iPhone Preview iPad Preview Mac Preview Featu

Andrea Miotto 127 Dec 21, 2022
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. 🌶

RHSideButtons ?? Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app

Robert Herdzik 166 Nov 14, 2022
An easy to use and setup floating view for your app. 🎡

HHFloatingView An easy to use and setup floating view for your app. ?? Installation Manually - Add HHFloatingView/Source folder to your Project. And y

Hemang 95 Dec 15, 2022
You can easily add awesome animated context menu to your app.

Context-Menu.iOS You can easily add awesome animated context menu to your app. Made in Check this [project on dribbble] (https://dribbble.com/shots/17

Yalantis 1.8k Nov 17, 2022