{"id":21275708,"url":"https://github.com/shial4/swindow","last_synced_at":"2025-07-11T08:30:37.326Z","repository":{"id":62454647,"uuid":"92896383","full_name":"shial4/SWindow","owner":"shial4","description":"Easy to use Swift windows manager","archived":false,"fork":false,"pushed_at":"2019-03-26T04:08:08.000Z","size":322,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-03T20:08:17.851Z","etag":null,"topics":["ios","ios-lib","ios-swift","presentation-tools","presenter","swift","uiwindow"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shial4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-31T02:36:05.000Z","updated_at":"2024-02-14T11:57:36.000Z","dependencies_parsed_at":"2022-11-01T22:46:41.065Z","dependency_job_id":null,"html_url":"https://github.com/shial4/SWindow","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/shial4/SWindow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FSWindow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FSWindow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FSWindow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FSWindow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shial4","download_url":"https://codeload.github.com/shial4/SWindow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FSWindow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264765511,"owners_count":23660575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","ios-lib","ios-swift","presentation-tools","presenter","swift","uiwindow"],"created_at":"2024-11-21T09:36:33.198Z","updated_at":"2025-07-11T08:30:37.034Z","avatar_url":"https://github.com/shial4.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SWindow\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Swift-5.0-brightgreen.svg\" alt=\"Language\" /\u003e\n        \u003c/a\u003e\n    \u003ca href=\"https://raw.githubusercontent.com/shial4/SWindow/master/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/shial4/SWindow\"\u003e\n        \u003cimg src=\"https://travis-ci.org/shial4/SWindow.svg?branch=master\" alt=\"TravisCI\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/SWindow\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/v/SWindow.svg\" alt=\"CocoaPods\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/carthage-compatible-4BC51D.svg?style=flat\" alt=\"Carthage\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nSWindow 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!\n\n## 💊 Usage\n**Basic Example**\nMake your controller conform to `SModalPresentation` protocol\n```swift\nclass YourController: UIViewController, SModalPresentation {}\n```\nTo present your controller simple call:\n```swift\nlet controller = YourController()\ncontroller.sPresent()\n```\nTo dismiss or remove from wait queue call:\n```swift\ncontroller.sWithdraw()\n```\nIf you want replace current presented controller with other call:\n```swift\ncontroller.sReplace(with: newController)\n```\n\nSWindow 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.\n\n**Advance Configuration**\nAbove was pretty simple example. However SWindow provides multiple configuration options.\n\nFirst thing what you can do is to extend SModal class with your own values.\nBelove you can see an example what can you modify.\n```swift\nextension SModal {\n    static var shouldMakeKey: Bool {\n        return false\n    }\n    \n    static var windowLevel: UIWindowLevel {\n        return UIWindowLevelAlert - 1\n    }\n    \n    static var animationDuration: TimeInterval {\n        return 0.2\n    }\n}\n```\nFirst 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.\n\nSecond 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.\n```swift\nextension YourController {    \n    public var canDismiss: Bool {\n        return false\n    }\n    \n    public var priority: SModalPriority {\n        return .Required\n    }\n}\n```\nAs 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`.\n\nLast things to extend are:\n`sPresent()`\n`sWithdraw()`\n`sReplace(with: UIViewController)`\nEach of this method have additional arguments with defaults set as follows `animated: Bool = false, completion: (() -\u003e Void)? = nil`\n\n## 🔧 Installation\n\n**CocoaPods:**\n\nAdd the line `pod \"SWindow\"` to your `Podfile`\n\n**Carthage:**\n\nAdd the line `github \"shial4/swindow\"` to your `Cartfile`\n\n**Manual:**\n\nClone the repo and drag the file `SWindow.swift` into your Xcode project.\n\n**Swift Package Manager:**\n\nAdd the line `.package(url: \"https://github.com/shial4/SWindow.git\", from: \"0.1.10\")` to your `Package.swift`\n\n## ⭐ Contributing\n\nBe welcome to contribute to this project! :)\n\n## ❓ Questions\n\nJust create an issue on GitHub.\n\n## 📝 License\n\nThis project was released under the [MIT](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshial4%2Fswindow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshial4%2Fswindow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshial4%2Fswindow/lists"}