https://github.com/mainasuk/cocoascenemanager
https://github.com/mainasuk/cocoascenemanager
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mainasuk/cocoascenemanager
- Owner: MainasuK
- Created: 2020-05-15T13:15:43.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-15T13:16:44.000Z (about 6 years ago)
- Last Synced: 2025-06-26T14:51:15.373Z (about 1 year ago)
- Language: Swift
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CocoaWindowManager
Simple app scene manager for the Cocoa App.
## Setup
Create the scene manager class.
```swift
import Cocoa
import CocoaSceneManager
final class AppSceneManager: SceneManager {
// MARK: - Singleton
public static let shared = AppSceneManager()
private override init() {
super.init()
}
}
```
Create App scene and conform it to `ManagableScene`. For example:
```swift
import Cocoa
import CocoaSceneManager
enum AppScene: ManagableScene {
case main(document: Document)
case …
…
}
```
## Usage
Use `open(_:active:)` method on the `AppSceneManager` and it will save the scene and related window controller in the pool. Manager will reuse same window controller for the same hash value scene.
```swift
let windowController = AppSceneManager.shared.open(.main(document: document))
```