{"id":21768132,"url":"https://github.com/below/shortcutsegue","last_synced_at":"2025-03-21T05:43:46.990Z","repository":{"id":66512632,"uuid":"130835535","full_name":"below/ShortcutSegue","owner":"below","description":"A sample to illustrate a storyboard segue navigation question","archived":false,"fork":false,"pushed_at":"2018-04-24T11:29:11.000Z","size":3232,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-26T02:44:07.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/below.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-24T10:14:45.000Z","updated_at":"2018-04-28T07:08:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b97028c-cbac-4e60-8d79-ad19853d8aa3","html_url":"https://github.com/below/ShortcutSegue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FShortcutSegue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FShortcutSegue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FShortcutSegue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FShortcutSegue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/below","download_url":"https://codeload.github.com/below/ShortcutSegue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244745708,"owners_count":20503048,"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-11-26T13:33:44.528Z","updated_at":"2025-03-21T05:43:46.965Z","avatar_url":"https://github.com/below.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ShortcutSegue\nA sample to illustrate a storyboard segue navigation question\n\n## Objective\nI would like to present the ViewController \"C\" directly from \"A\" while retaining the navigation flow, i.e. afterwards, the \"Back\" button on \"C\" should return to \"B\".\n\n## Solution\nIt is actually quite simple: You just rearrange the stack of view controllers on the `UINavigationController`:\n\n```Swift\nlet storyboard = self.storyboard! // As this is a sample, I am a bit liberal with force unwrapping\n\n// This depends a bit from where you are coming. Sometimes you don't want the last viewController on the stack\nvar controllers : [UIViewController] = self.navigationController!.viewControllers\n\nvar controller = storyboard.instantiateViewController(withIdentifier: \"B\")\n// Remember to do the things here you'd do in prepareForSegue!\ncontrollers.append(controller)\n\ncontroller = storyboard.instantiateViewController(withIdentifier: \"C\")\ncontrollers.append(controller)\n\nself.navigationController!.setViewControllers(controllers, animated: true)\n```\n\nLet me know what you think!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelow%2Fshortcutsegue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelow%2Fshortcutsegue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelow%2Fshortcutsegue/lists"}