SPLarkController

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

Github星跟蹤圖

SPLarkController

About

Transition between controllers to top. You can change animatable height after presentation controller. For implement settings as in preiew, see section Settings Controller.

You can download example app Code - Learn Swift & Design from AppStore. For buy source code of app in preview, go to:

xcode-shop.com

If you like the project, do not forget to put star ★ and follow me on GitHub:

https://github.com/ivanvorobei

See project's backers in Sponsors section.

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

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.

Sponsors

Support me with a monthly donation and help me continue activities. After payment I add you to list of sponsor in my all projects with link to your profile. Become a sponsors




My projects

SPStorkController

SPStorkController is сontroller as in Apple Music, Podcasts and Mail apps. Simple adding close button and centering arrow indicator. Customizable height. Using custom TransitionDelegate. Check scroll's bounce for more interactive. Simple adding close button and centering arrow indicator. You can download example Debts - Spending tracker app from AppStore.

Alert you can find in SPAlert project. If you want to buy source code of app in preview, please, go to xcode-shop.com


SPAlert

SPAlert is popup from Apple Music & Feedback in AppStore. Contains Done & Heart presets. Done present with draw path animation. I clone Apple's alerts as much as possible.
You can find this alerts in AppStore after feedback, after added song to library in Apple Music. I am also add alert without icon, as simple message.

You can download example Debts - Spending tracker app from AppStore. If you want to buy source code of app in preview, please, go to xcode-shop.com.


SPPermission

SPPermission allow request permissions with native dialog UI and interactive animations. Also you can request permissions without dialog. Check state any permission. You can start using this project with just two lines of code and easy customisation.

You can buy example Dialog & Dinamic animations in xcode-shop.com, see preview.

License

SPLarkController is released under the MIT license. Check LICENSE.md for details.

主要指標

概覽
名稱與所有者ivanvorobei/SPLarkController
主編程語言Swift
編程語言Swift (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2019-02-24 09:28:05
推送於2022-03-27 17:48:29
最后一次提交2021-10-01 14:17:01
發布數18
最新版本名稱1.2.1 (發布於 )
第一版名稱1.0.0 (發布於 )
用户参与
星數1k
關注者數20
派生數48
提交數183
已啟用問題?
問題數11
打開的問題數2
拉請求數6
打開的拉請求數0
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?