https://github.com/openalloc/swiftsideways
A multi-platform SwiftUI component for the horizontal scrolling of tabular data in compact areas
https://github.com/openalloc/swiftsideways
Last synced: 5 months ago
JSON representation
A multi-platform SwiftUI component for the horizontal scrolling of tabular data in compact areas
- Host: GitHub
- URL: https://github.com/openalloc/swiftsideways
- Owner: openalloc
- License: apache-2.0
- Created: 2022-03-12T22:17:24.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-01T23:59:34.000Z (over 2 years ago)
- Last Synced: 2024-11-08T21:34:10.357Z (about 1 year ago)
- Language: Swift
- Size: 465 KB
- Stars: 2
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# SwiftSideways
A multi-platform SwiftUI component for the horizontal scrolling of tabular data in compact areas
Available as an open source library to be incorporated in SwiftUI apps.
_SwiftSideways_ is part of the [OpenAlloc](https://github.com/openalloc) family of open source Swift software tools.
macOS | iOS
:---:|:---:
 | 
## Features
* Support the horizontal scrolling of wide content, such as tabular data, in compact views
* Available as a conventional view that can wrap your content, and also as a View Modifier
* Presently targeting macOS v11+ and iOS v14+\*
* No external dependencies!
## Sideways Examples
Use with any wide content, such as `List`:
```swift
import SwiftUI
import Sideways
struct ContentView: View {
var body: some View {
List {
Text("π Pinot Noir, π Blauburgunder, π SpΓ€tburgunder, π RulandskΓ© modrΓ©, π Pinot Nero")
Text("π Cabernet Sauvignon, π Bouchet, π Bouche, π Petit-Bouchet, π Petit-Cabernet, π Petit-Vidure, π Vidure, π Sauvignon Rouge")
Text("π Syrah, π Shiraz, π Hermitage, π Antourenein noir, π Candive")
Text("π Gamay, π Gamay Noir Γ Jus Blanc Sicily")
Text("π Grenache, π Garnatxa negre, π Alicante, π Cannonau, π Garnacha tinta, π Grenache noir")
Text("π Cabernet Franc, π Bouchet, π Bouchy, π Breton")
Text("π Malbec, π Auxerrois in Cahors, π CΓ΄t, π Pressac")
Text("π Merlot, π Saint-Macaire, π Picard, π Langon")
Text("π Petit Verdot, π Verdot")
}
.sideways(minWidth: 1200, showIndicators: true)
.frame(width: 400)
}
}
```
...where the `minWidth` of 1200 specifies the width of your content in the scrollable region.
The frame width of 400 is the viewport size. It's explicit here, but often it's implicit and not necessary to specify.
You can also wrap your content in a `Sideways` view:
```swift
var body: some View {
Sideways(minWidth: 1200) {
List {
...
}
}
}
```
Or an excerpt from use with the companion component _TablerList_...
```swift
var body: some View {
TablerList(header: header,
row: row,
results: fruits)
.sideways(minWidth: 1200)
}
```
## Hat tips
Based on code and ideas found at:
* [onmyway133](https://github.com/onmyway133/blog/issues/769)
* [NuPlay](https://github.com/NuPlay/FitScrollView)
And the OG software...

## See Also
This library is a member of the _OpenAlloc Project_.
* [_OpenAlloc_](https://openalloc.github.io) - product website for all the _OpenAlloc_ apps and libraries
* [_OpenAlloc Project_](https://github.com/openalloc) - Github site for the development project, including full source code
## License
Copyright 2021, 2022 OpenAlloc LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
## Contributing
Contributions are welcome. You are encouraged to submit pull requests to fix bugs, improve documentation, or offer new features.
The pull request need not be a production-ready feature or fix. It can be a draft of proposed changes, or simply a test to show that expected behavior is buggy. Discussion on the pull request can proceed from there.