Easy to use Swift windows manager

What's New

Release 0.2.0


Update to swift 5


Language License TravisCI CocoaPods Carthage

SWindow is an easy to use Swift windows manager. Don't spend hours writing your code to present and dismiss modal view controllers, stop wasting your time on debugging why your modal presentation disapear. Without issues, simple and safe present your controller!

💊 Usage

Basic Example Make your controller conform to SModalPresentation protocol

class YourController: UIViewController, SModalPresentation {}

To present your controller simple call:

let controller = YourController()

To dismiss or remove from wait queue call:


If you want replace current presented controller with other call:

controller.sReplace(with: newController)

SWindow automatically add your controller to queue if other is currently presented. Moreover on sWithdraw() event after dismiss will present first controller from queue with highest priority.

Advance Configuration Above was pretty simple example. However SWindow provides multiple configuration options.

First thing what you can do is to extend SModal class with your own values. Belove you can see an example what can you modify.

extension SModal {
    static var shouldMakeKey: Bool {
        return false
    static var windowLevel: UIWindowLevel {
        return UIWindowLevelAlert - 1
    static var animationDuration: TimeInterval {
        return 0.2

First of all in every project I would extend SModal to return true under shouldMakeKey thanks to that our window will become keyWindow and will receive system events.

Second thing you can adjust is SModalPresentation. your Controller can be dismiss by SWindow if you return true under canDismiss. Thanks to this parameter what ever will pop in to queue and the current presented controller will be return positive value under this flag SWindow will dismiss it and present next one from the queue.

extension YourController {    
    public var canDismiss: Bool {
        return false
    public var priority: SModalPriority {
        return .Required

As I have wrote earlier YourController is ordered by priority during dequeue for presentation. You can change priority for each of your controllers coresponding to SModalPresentation.

Last things to extend are: sPresent() sWithdraw() sReplace(with: UIViewController) Each of this method have additional arguments with defaults set as follows animated: Bool = false, completion: (() -> Void)? = nil

🔧 Installation


Add the line pod "SWindow" to your Podfile


Add the line github "shial4/swindow" to your Cartfile


Clone the repo and drag the file SWindow.swift into your Xcode project.

Swift Package Manager:

Add the line .package(url: "https://github.com/shial4/SWindow.git", from: "0.1.10") to your Package.swift


Be welcome to contribute to this project! :)


Just create an issue on GitHub.

📝 License

This project was released under the MIT license.


  • Swift Tools 4.2.0
View More Packages from this Author


  • None
Last updated: Thu Mar 16 2023 22:26:56 GMT-0500 (GMT-05:00)