{"id":18450192,"url":"https://github.com/iosdevgarg/container_views","last_synced_at":"2025-04-18T00:27:16.111Z","repository":{"id":143697989,"uuid":"118086998","full_name":"iOSDevGarg/Container_Views","owner":"iOSDevGarg","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-19T06:45:26.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T23:09:17.847Z","etag":null,"topics":["containers","containerview","tableview","uitableview","uiviewcontroller"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iOSDevGarg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-19T06:33:56.000Z","updated_at":"2018-01-23T10:41:34.000Z","dependencies_parsed_at":"2023-06-14T11:30:39.739Z","dependency_job_id":null,"html_url":"https://github.com/iOSDevGarg/Container_Views","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/iOSDevGarg%2FContainer_Views","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iOSDevGarg%2FContainer_Views/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iOSDevGarg%2FContainer_Views/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iOSDevGarg%2FContainer_Views/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iOSDevGarg","download_url":"https://codeload.github.com/iOSDevGarg/Container_Views/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249167445,"owners_count":21223506,"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":["containers","containerview","tableview","uitableview","uiviewcontroller"],"created_at":"2024-11-06T07:23:56.951Z","updated_at":"2025-04-15T23:09:31.865Z","avatar_url":"https://github.com/iOSDevGarg.png","language":"Swift","readme":"# Container_Views\n\nAdd Other ViewControllers As subview in Container View \n\n# Code Used\n\n**Reference to Controller to be added as Subview**\n\n      private lazy var FirstObject: firstVC =\n      {\n        // Instantiate View Controller\n        let viewController = self.storyboard?.instantiateViewController(withIdentifier: \"firstVC\") as! firstVC\n        \n        // Add View Controller as Child View Controller\n        self.addChildViewController(viewController)\n        return viewController\n      }()\n      \n* Used Table Views As Subview in Second Controller Thus, Complex Designs can also be implemnted in same manner\n\n# Adding subview to Container View\n\n     private func add(asChildViewController viewController: UIViewController)\n    {\n        // Configure Child View\n        viewController.view.frame = CGRect(x: 0, y: 0, width: self.firstContainer.frame.size.width, height: self.firstContainer.frame.size.height)\n        \n        // Add Child View Controller\n        addChildViewController(viewController)\n        viewController.view.translatesAutoresizingMaskIntoConstraints = true\n        \n        // Add Child View as Subview\n        firstContainer.addSubview(viewController.view)\n        \n        // Notify Child View Controller\n        viewController.didMove(toParentViewController: self)\n    }\n    \n**Subviews Are being managed using code So, If required Added VC as Subview can aslo be Removed using**\n\n     private func remove(asChildViewController viewController: UIViewController)\n    {\n        // Notify Child View Controller\n        viewController.willMove(toParentViewController: nil)\n        \n        secondContainer.willRemoveSubview(viewController.view)\n        \n        // Remove Child View From Superview\n        viewController.view.removeFromSuperview()\n        \n        // Notify Child View Controller\n        viewController.removeFromParentViewController()\n    }\n      \n# Expected Output\n\n![simulator screen shot - iphone 8 plus - 2018-01-19 at 12 06 44](https://user-images.githubusercontent.com/26831784/35137808-3f986ff2-fd11-11e7-8c5c-b8f7f6fbebf5.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiosdevgarg%2Fcontainer_views","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiosdevgarg%2Fcontainer_views","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiosdevgarg%2Fcontainer_views/lists"}