Code Monkey home page Code Monkey logo

swiftsideways's Introduction

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

  • TablerDemo - the demonstration app for this library, for value data sources
  • TablerCoreDemo - the demonstration app for this library, for Core Data sources

Swift open-source libraries (by the same author):

  • SwiftTabler - multi-platform SwiftUI component for displaying (and interacting with) tabular data
  • SwiftDetailer - multi-platform SwiftUI component for editing fielded data
  • SwiftDetailerMenu - optional menu support for SwiftDetailer
  • AllocData - standardized data formats for investing-focused apps and tools
  • FINporter - library and command-line tool to transform various specialized finance-related formats to the standardized schema of AllocData
  • SwiftCompactor - formatters for the concise display of Numbers, Currency, and Time Intervals
  • SwiftModifiedDietz - A tool for calculating portfolio performance using the Modified Dietz method
  • SwiftNiceScale - generate 'nice' numbers for label ticks over a range, such as for y-axis on a chart
  • SwiftRegressor - a linear regression tool that’s flexible and easy to use
  • SwiftSeriesResampler - transform a series of coordinate values into a new series with uniform intervals
  • SwiftSimpleTree - a nested data structure that’s flexible and easy to use

And open source apps using this library (by the same author):

  • FlowAllocator - portfolio rebalancing tool for macOS
  • FlowWorth - a new portfolio performance and valuation tracking tool for macOS

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.

swiftsideways's People

Forkers

laweven

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.