Git Product home page Git Product logo

blackjacx / source Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 3.03 MB

Tired of implementing the data sources over and over again? Want to use a lightweight solution that does not mess up your view controllers? Then this is for you! The generic data source implementation for all your view controllers, that supports UITableView, UICollectionView and NSFetchedResultsController

License: MIT License

Ruby 3.39% Swift 95.57% Objective-C 1.04%
ios uitableview uicollectionview swift xcode apple datasource spm swiftpackage swiftpackagemanager

source's Introduction

Twitter Follow CI status Swift Package Manager Compatible Github Current Release Platforms Xcode 15 iOS 14.0+ Swift 5.10 Github Repo Size Github Code Size Github Closed PR's License codebeat badge Donate

Source

Tired of implementing the data sources over and over again? Want to use a lightweight solution that does not mess up your view controllers? Then this is for you! The generic data source implementation for all your view controllers, that supports UITableView, UICollectionView and NSFetchedResultsController.

Install

In Xcode open your target list and select your project. Click the tab Swift Packages and there the small + icon. Enter the URL of this repository, select the version you want to install - usually the preset is okay - and confirm.

Simply add the following line to your Podfile:

pod "Source"

Example

iOS

The repo includes an example project. To run it, just type pod try Source in your console and it will be downloaded and opened for you.

Contribution

  • If you found a bug, please open an issue.
  • If you have a feature request, please open an issue.
  • If you want to contribute, please submit a pull request.

Author

Stefan Herold โ€ข ๐Ÿฆ @Blackjacxxx

Contributors

Thanks to all of you who are part of this:

License

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

source's People

Contributors

blackjacx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

source's Issues

Update View Models Without Reloading The Table

Expected behaviour

It must be possible to update the view models without reloading the table view. When you use a e.g. UISwitch and press it the change must be reflected in the view model but since the switch value has already changed it is not necessary to update reload the cell.

Actual behaviour

On update of view models the table is always reloaded.

Implement TableView functions

  • optional public func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool
  • optional public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath)
  • optional public func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)

Support performBatchUpdate

Hey there, so far you always call reloadData on the table view when the datasource gets updated. It would be more efficient/elegant/pretty to do the diffing first and then insert/delete the items that changed. Pre iOS 13 that is, after that it's just a one liner, but either way reloadData ain't ideal. ^^

๐Ÿšจ Fix Cells LayoutMargins

Expected behaviour

Remove from adjustCellSeparatorInsets(...):

        // explicitly setting cell's layout margins
        directionalLayoutMargins = insets

to be able to properly use directionalLayoutMargins โœŒ๏ธ

Make sure to use this one again in TableContainer instead of updateCellSeparatorInsets()

Actual behaviour

directionalLayoutMargins are not usable since they are influenced by this setting on the UITableViewCell.

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.