{"id":13461952,"url":"https://github.com/coffellas-cto/KSNavigationController","last_synced_at":"2025-03-24T23:32:00.703Z","repository":{"id":80190495,"uuid":"64773433","full_name":"coffellas-cto/KSNavigationController","owner":"coffellas-cto","description":"UINavigationController for macOS (Swift, Objective-C)","archived":false,"fork":false,"pushed_at":"2016-10-03T18:23:49.000Z","size":58,"stargazers_count":55,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T10:03:17.957Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/coffellas-cto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-08-02T16:26:26.000Z","updated_at":"2024-05-22T21:16:09.000Z","dependencies_parsed_at":"2024-02-17T10:44:52.306Z","dependency_job_id":null,"html_url":"https://github.com/coffellas-cto/KSNavigationController","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffellas-cto%2FKSNavigationController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffellas-cto%2FKSNavigationController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffellas-cto%2FKSNavigationController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffellas-cto%2FKSNavigationController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coffellas-cto","download_url":"https://codeload.github.com/coffellas-cto/KSNavigationController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372193,"owners_count":20604487,"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":[],"created_at":"2024-07-31T12:00:36.111Z","updated_at":"2025-03-24T23:32:00.431Z","avatar_url":"https://github.com/coffellas-cto.png","language":"Swift","funding_links":[],"categories":["UI"],"sub_categories":[],"readme":"# KSNavigationController v0.3\nUINavigationController for macOS (Swift, Objective-C)\n\n![ksnavigationcontrollerdemo](https://cloud.githubusercontent.com/assets/3193877/17337372/04002c08-58eb-11e6-9c1f-2cabdea4dd66.gif)\n\nLooking for macOS (Mac OS X) analog of UIKit's `UINavigationController` from iOS? This class mimics its behavior.\n\n**Attention**: Navigation bar is not implemented. All methods must be called from main thread.\n\nSwift version (3.0): [KSNavigationController/Swift](https://github.com/coffellas-cto/KSNavigationController/tree/master/KSNavigationController/Swift)\n\nObjC version: [KSNavigationController/ObjectiveC](https://github.com/coffellas-cto/KSNavigationController/tree/master/KSNavigationController/ObjectiveC)\n\nFor Swift 2.2 support see [version 0.1](https://github.com/coffellas-cto/KSNavigationController/releases/tag/v0.1).\n\n## Usage\n### Creating a navigation controller\n```swift\n// Swift\nlet vc1 = TestViewController()\nlet navVC = KSNavigationController(rootViewController: vc1)\nnavVC?.view.frame = NSMakeRect(0.0, 0.0, 480.0, 272.0) // Or use constraints if appropriate\nself.window.contentViewController = navVC\nself.window.orderFrontRegardless()\n```\n\n```objc\n// ObjC\nTestViewController *vc1 = [[TestViewController alloc] init];\nKSNavigationController *navVC = [[KSNavigationController alloc] initWithRootViewController:vc1];\nnavVC.view.frame = NSMakeRect(0.0, 0.0, 480.0, 272.0); // Or use constraints if appropriate\nself.window.contentViewController = navVC;\n[self.window orderFrontRegardless];\n```\nHere your `TestViewController` class is a subclass of `NSViewController`. It also has to conform to `KSNavigationControllerCompatible` protocol in order to have access to `navigationController` property.\n### Pushing and popping view controllers onto / from stack\nNow, inside your `NSViewController` you can access `navigationController` property (just like in iOS) and push any new view controller on top of navigation stack:\n```swift\n// Swift\n@IBAction func pushAction(sender: AnyObject) {\n    self.navigationController?.pushViewController(TestViewController(), animated: true)\n}\n```\n\n```objc\n// ObjC\n- (IBAction)pushAction:(id)sender {\n    [self.navigationController pushViewController:[[TestViewController alloc] init] animated:YES];\n}\n```\n\nDo the following to pop the top view controller from stack:\n```swift\n// Swift\nself.navigationController?.popViewControllerAnimated(true)\n```\n\n```objc\n// ObjC\n[self.navigationController popViewControllerAnimated:YES];\n```\n\n## KSNavigationControllerCompatible protocol\nConform to this protocol if you want your `NSViewController` subclass to work with `KSNavigationController`.\n\nThis protocol has only one property:\n```swift\n/*Swift*/ weak var navigationController: KSNavigationController? {get set}\n```\n\n```objc\n/*ObjC*/ @property (weak, nonatomic) KSNavigationController *navigationController;\n```\n\n**Warning:** Do not set this properly by yourself.\n\n**Objective-C only:**\nYou must synthesize `navigationController` property explicitly in your subclass implementation:\n```objc\n@synthesize navigationController = _navigationController;\n```\n\nSee example projects for more understanding.\n\n## License\nPublished under MIT license.\n\nCopyright (c) 2016 A. Gordiyenko.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoffellas-cto%2FKSNavigationController","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoffellas-cto%2FKSNavigationController","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoffellas-cto%2FKSNavigationController/lists"}