MIT License

项目介绍

stuffrabbit/SwiftSpreadsheet 是一个托管在 GitHub 上的开源项目,主要使用 Swift 编写,采用 MIT License 许可证,目前获得 637 个 Star、39 次 Fork。

仓库全名
stuffrabbit/SwiftSpreadsheet
开源许可证
MIT License
Star 数
637
Fork 数
39
未关闭 Issue
4

README 摘要

SwiftSpreadsheet Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Swift 5.0 Installation SwiftSpreadsheet is available through CocoaPods. To install it, simply add the following line to your Podfile: Demo Quick start A short introduction on how to get started: The rows of the spreadsheet represent a section in the collection view, with columns…

完整内容见 GitHub 原始 README 或本页 。

常见问题

SwiftSpreadsheet 用什么语言开发?

主要使用 Swift 编写,采用 MIT License 许可证,目前有 637 个 Star。

SwiftSpreadsheet 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 SwiftSpreadsheet 的源码?

可以直接克隆仓库:git clone https://github.com/stuffrabbit/SwiftSpreadsheet.git;安装与运行步骤见仓库 README。

SwiftSpreadsheet 最近还在维护吗?

仓库最近一次更新为 2019年10月16日,当前有 4 个未关闭 Issue;Star 数为 637,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Spreadsheet CollectionViewLayout in Swift. Fully customizable. 🔶

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
1352
价值分
457
活跃状态
活跃

语言占比

Ruby
Swift

README

SwiftSpreadsheet

Version License Platform Swift Package Manager compatible

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Swift 5.0

Installation

SwiftSpreadsheet is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SwiftSpreadsheet"

Demo

Output sample

Quick start

A short introduction on how to get started:

The rows of the spreadsheet represent a section in the collection view, with columns being the respective items. The leftmost and the rightmost elements of the spreadsheet (leftRowHeadline and rightRowHeadline), as well as the topmost and the bottommost elements (topColumnHeader and bottomColumnFooter) are represented as UISupplementaryView, which — if needed — have to be registered with the respective identifiers of the provided enum ViewKindType (refer to the example code).

The corners of the resulting spreadsheet are represented as UIDecorationView which can be passed as UINib or as AnyClass upon initialization of the layout. To allow more flexibilty you have to pass the given nib or class via the DecorationViewType enum. Its cases hold one of the respective types as associative value: asNib(myNib) or asClass(myClass).

A short example:

//Register SupplementaryViews first, then initialize the layout with optional Nibs/Classes for the DecorationViews
let layout = SpreadsheetLayout(delegate: self,
                               topLeftDecorationViewType: .asNib(topLeftDecorationViewNib),
                               topRightDecorationViewType: .asNib(topRightDecorationViewNib),
                               bottomLeftDecorationViewType: .asClass(bottomLeftDecorationViewClass),
                               bottomRightDecorationViewType: .asClass(bottomRightDecorationViewClass))

//Default is true, set false here if you do not want some of these sides to remain sticky
layout.stickyLeftRowHeader = true
layout.stickyRightRowHeader = true
layout.stickyTopColumnHeader = true
layout.stickyBottomColumnFooter = true

self.collectionView.collectionViewLayout = layout

Implement the provided SpreadsheetLayoutDelegate. The methods are straightforward. Simply pass nil wherever you do not want supplementary views to be displayed (leftmost, rightmost, topmost and bottommost).

Reload Layout:

//On Layout:
layout.resetLayoutCache()
//Helper Method for collection view
collectionView.reloadDataAndSpreadsheetLayout()

So in short:

  1. Register the respective objects of type UISupplementaryView you want to use with the provided identifiers of the enum ViewKindType.
  2. Create a UINib object for each UIDecrationView (corner of the Spreadsheet) and pass it upon initialization of the layout.
  3. Initialize the layout with the provided convenience initializer and pass the delegate as well as the required decoration views.
  4. Implement the SpreadsheetLayoutDelegate.
  5. Set the content of your cells and the supplementary views in the data source methods of your collection view.
  6. Enjoy ;)

Questions

Please refer to the demo application or contact me directly.

Author

Wojtek Kordylewski.

indiControl GmbH owns the Copyright of the respective SwiftSpreadsheet.swift file.

License

SwiftSpreadsheet is available under the MIT license. See the LICENSE file for more info.

评论

暂无评论