Swiftpack.co - openalloc/SwiftSideways as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by openalloc.
openalloc/SwiftSideways 0.5.4
A multi-platform SwiftUI component for the horizontal scrolling of tabular data in compact areas
⭐️ 1
πŸ•“ 2 years ago
iOS macOS
.package(url: "https://github.com/openalloc/SwiftSideways.git", from: "0.5.4")

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 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:

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:

var body: some View {
    Sideways(minWidth: 1200) {
        List {
            ...
        }
    }
}

Or an excerpt from use with the companion component TablerList...

var body: some View {
    TablerList(header: header,
               row: row,
               results: fruits)
        .sideways(minWidth: 1200)
}

Hat tips

Based on code and ideas found at:

And the OG software...

See Also

This library is a member of the OpenAlloc Project.

  • OpenAlloc - product website for all the OpenAlloc apps and libraries
  • OpenAlloc Project - 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

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.

GitHub

link
Stars: 1
Last commit: 50 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Experimenting with simpler implementation
2 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics