SPLarkController - 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 ★ and follow me on GitHub:

https://github.com/ivanvorobei

Navigate

Requirements

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

Installation

CocoaPods:

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

pod 'SPLarkController'

Manually

If you prefer not to use any of the aforementioned dependency managers, you can integrate SPLarkController into your project manually. Put Source/SPLarkController 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

SPAlert

You can find this alerts in AppStore after feedback or after added song to library in Apple Music. Contains popular Done, Heart presets and many other. Done preset present with draw path animation like original. Also available simple present message without icon. Usage in one line code.

SPPerspective

Animation of widgets from iOS 14. 3D transform with dynamic shadow. Look video preview. Available deep customisation 3D and shadow. Also you can use static transform without animation.

SPPermissions

Using for request and check state of permissions. Available native UI for request multiple permissions at the same time. Simple integration and usage like 2 lines code.

SPDiffable

Simplifies working with animated changes in table and collections. Apple's diffable API required models for each object type. If you want use it in many place, you pass time to implement it and get over duplicates codes. This project help do it elegant with shared models and special cell providers. Support side bar iOS14 and already has native cell providers and views.

SparrowKit

Collection of native Swift extensions to boost your development. Support tvOS and watchOS.

Russian Community

В телеграм-канале Код Воробья пишу о iOS разработке. Помощь можно найти в нашем чате. Видео-туториалы выклыдываю на 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
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:

Andrea Mazzini 3.3k Dec 28, 2022
This component implements transition animation to crumble view-controller into tiny pieces.

StarWars Animation This component implements transition animation to crumble view-controller into tiny pieces. Check this project on dribbble. Also, r

Yalantis 3.7k Dec 29, 2022
Custom interactive transition like Apple Music iOS App (iOS 9). written in Swift.

MusicPlayerTransition Custom interactive transition like Apple Music iOS App. written in Swift. Demo See demo on Appetize.io Using Transition Animator

Airin 642 Nov 17, 2022
Elegant transition library for iOS & tvOS

Hero is a library for building iOS view controller transitions. It provides a declarative layer on top of the UIKit's cumbersome transition APIs—makin

Hero Transitions 21.2k Jan 3, 2023
This is a Swift based demo project to show how to make the transition Pinterest liked.

PinterestSwift Compatible with Xcode 11 / Swift 5.0 This is a Swift based demo project to show how to make the transition Pinterest 2.0+ liked. Refer

Nicholas Tau 1.9k Dec 20, 2022
Simple and elegant Dropdown Transition

Simple and elegant dropdown transition for iOS Why? I needed to perform the dropdown transition in the app I was building and I've found many great li

Aidar Nugmanoff 63 Sep 22, 2022
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.

SPStorkController About Controller as in Apple Music, Podcasts and Mail apps. Help if you need customize height or suppport modal style in iOS 12. Sim

Ivan Vorobei 2.6k Jan 4, 2023
A simple way to create custom interactive UIViewController transitions

EasyTransitions is a library that helps developers create custom interactive transitions using simple functions defined in a protocol and avoid handli

Marcos Griselli 1.6k Jan 1, 2023
Easy interactive interruptible custom ViewController transitions

Introduction Transition is a library that helps you build iOS view controller transitions. Implementing a nice interactive custom view controller tran

Touchwonders 2.6k Dec 20, 2022
Painless custom transitioning. Easy extend, easy setup, just focus on animations.

TransitionManager Painless custom transitioning. Easy extend, easy setup, just focus on animations. Installation CocoaPods You can use CocoaPods to in

Cem Olcay 205 Aug 23, 2022
Awesome iOS 11 appstore cards in swift 5.

Cards brings to Xcode the card views seen in the new iOS XI Appstore. Getting Started Storyboard Go to main.storyboard and add a blank UIView Open the

Paolo Cuscela 4.1k Dec 14, 2022
Custom transition between controllers. Settings controller for your iOS app.

SPLarkController About Transition between controllers to top. You can change animatable height after presentation controller. For presentation and dis

Ivan Vorobei 965 Dec 17, 2022
Custom-Transition - A repo about custom transition between two view controllers

Custom-Transition in SWIFT This is a repo about custom transition between two vi

Prakash Chandra Awal 0 Jan 6, 2022
LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.

LNPopupController LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and

Leo Natan 2.9k Jan 2, 2023
This iOS framework allows settings to be in-app in addition to or instead of being in the Settings app.

InAppSettingsKit InAppSettingsKit (IASK) is an open source framework to easily add in-app settings to your iOS or Catalyst apps. Normally iOS apps use

Ortwin Gentz, FutureTap 3.1k Jan 2, 2023
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

jobandtalent 527 Dec 15, 2022
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

Christoffer Winterkvist 246 Dec 28, 2022
Custom transition between viewcontrollers holding tableviews

Custom transition between viewcontrollers holding tableviews. Each cell is animated to simulate a 'wave effect'. Read more about transitions here and

Andrea Mazzini 2.4k Dec 21, 2022
Custom transition between two collection view layouts

Display Switcher We designed a UI that allows users to switch between list and grid views on the fly and choose the most convenient display type. List

Yalantis 2.3k Dec 14, 2022
📱📲 Navigate between view controllers with ease. 💫 🔜 More stable version (written in Swift 5) coming soon.

CoreNavigation ?? ?? Navigate between view controllers with ease. ?? ?? More stable version (written in Swift 5) coming soon. Getting Started API Refe

Aron Balog 69 Sep 21, 2022