{"id":17078648,"url":"https://github.com/marty-suzuki/splittableviewkit","last_synced_at":"2025-04-12T20:34:29.739Z","repository":{"id":62455896,"uuid":"153963809","full_name":"marty-suzuki/SplittableViewKit","owner":"marty-suzuki","description":"A cell of IndexPath(row: 0, section: 0) in UITableView is automatically moved to left view when device rotated.","archived":false,"fork":false,"pushed_at":"2018-10-25T16:23:59.000Z","size":29017,"stargazers_count":37,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-26T14:50:55.391Z","etag":null,"topics":["orientation","rotation","split","swift","tableview"],"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/marty-suzuki.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":"2018-10-21T01:41:16.000Z","updated_at":"2023-08-26T13:21:27.000Z","dependencies_parsed_at":"2022-11-01T22:46:33.688Z","dependency_job_id":null,"html_url":"https://github.com/marty-suzuki/SplittableViewKit","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/marty-suzuki%2FSplittableViewKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty-suzuki%2FSplittableViewKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty-suzuki%2FSplittableViewKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty-suzuki%2FSplittableViewKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marty-suzuki","download_url":"https://codeload.github.com/marty-suzuki/SplittableViewKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631048,"owners_count":21136547,"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":["orientation","rotation","split","swift","tableview"],"created_at":"2024-10-14T12:22:57.295Z","updated_at":"2025-04-12T20:34:29.721Z","avatar_url":"https://github.com/marty-suzuki.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SplittableViewKit\n\n[![Language](http://img.shields.io/badge/Language-Swift-orange.svg?style=flat\n)](https://developer.apple.com/swift)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/SplittableViewKit.svg?style=flat)](https://cocoapods.org/pods/SplittableViewKit)\n[![License](https://img.shields.io/cocoapods/l/SplittableViewKit.svg?style=flat)](https://cocoapods.org/pods/SplittableViewKit)\n[![Platform](https://img.shields.io/cocoapods/p/SplittableViewKit.svg?style=flat)](https://cocoapods.org/pods/SplittableViewKit)\n\nA cell of `IndexPath(row: 0, section: 0)` in UITableView is automatically moved to left view when device rotated.\n\n![](./Images/sample.gif)\n\n## Usage\n\nPlease initialize `SplittableTableView` with initializer or Interface Builder.\n`SplittableTableView.rightView` is UITableView.\nDo not set delegate or dataSource directly to `SplittableTableView.rightView`.\nYou must use `SplittableTableView.delgate` or `SplittableTableView.dataSource`.\n\n```swift\nlet splittableTableView: SplittableTableView\n\nsplittableTableView.delegate = self\nsplittableTableView.dataSource = self\nsplittableTableView.rightView.register(UINib(nibName: \"ThumbnailViewCell\", bundle: nil),\n                                       forCellReuseIdentifier: \"ThumbnailViewCell\")\n```\n\nSplittableViewKit is almost same as UITableView interface because `SplittableTableViewDataSource` adopted UITableViewDataSource and `SplittableTableViewDelegate` adopted UITableViewDelegate.\n`func splittableContainerViewFor(topView: UIView, layoutType: LayoutType) -\u003e UIView` is only one difference.\nYou should return a UIView that layouted top view. Layout patterns are `LayoutType.left` and `LayoutType.fixedTop`.\n\n```swift\nextension ViewController: SplittableTableViewDataSource {\n    func splittableContainerViewFor(topView: UIView, layoutType: LayoutType) -\u003e UIView {\n        let view = UIView(frame: .zero)\n        topView.translatesAutoresizingMaskIntoConstraints = false\n        view.addSubview(topView)\n        if layoutType == .left {\n            NSLayoutConstraint.activate([\n                view.leadingAnchor.constraint(equalTo: topView.leadingAnchor, constant: 0),\n                view.trailingAnchor.constraint(equalTo: topView.trailingAnchor, constant: 0),\n                view.centerYAnchor.constraint(equalTo: topView.centerYAnchor, constant: 0)\n            ])\n        } else {\n            NSLayoutConstraint.activate([\n                view.safeAreaLayoutGuide.topAnchor.constraint(equalTo: topView.topAnchor, constant: 0),\n                view.leftAnchor.constraint(equalTo: topView.leftAnchor, constant: 0),\n                view.rightAnchor.constraint(equalTo: topView.rightAnchor, constant: 0),\n                view.bottomAnchor.constraint(equalTo: topView.bottomAnchor, constant: 0)\n            ])\n        }\n        return view\n    }\n}\n```\n\nYou can change fixed top or not with `SplittableTableView.isFixedTop`.\n\n```swift\nsplittableTableView.isFixedTop = true\n```\n\n| left | fixedTop |\n| :-: | :-: |\n| ![](./Images/normal.gif) | ![](./Images/fixed.gif) |\n\nYou can change ratio of leftView and rightView with `SplittableTableView.ratio`.\n\n```swift\nsplittableTableView.ratio = .init(left: 1, right: 2)\n```\n\n| left: 1, right: 1 | left: 2, right: 1 |\n| :-: | :-: |\n| ![](./Images/one-one.png) | ![](./Images/two-one.png) |\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the `SplittableViewKitExample` directory first.\n\n## Requirements\n\n- iOS 9 or greater\n- Swift 4 or greater\n\n## Installation\n\n### Carthage\n\nIf you’re using [Carthage](https://github.com/Carthage/Carthage), simply add SplittableViewKit to your `Cartfile`:\n\n```ruby\ngithub \"marty-suzuki/SplittableViewKit\"\n```\n\n### CocoaPods\n\nSplittableViewKit is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SplittableViewKit'\n```\n\n## Author\n\nmarty-suzuki, s1180183@gmail.com\n\n## License\n\nSplittableViewKit is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarty-suzuki%2Fsplittableviewkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarty-suzuki%2Fsplittableviewkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarty-suzuki%2Fsplittableviewkit/lists"}