From d189cbb8bfe47118c379064d90633eaf4721d1fc Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 14 May 2019 02:15:51 +0900 Subject: [PATCH 1/7] Update README --- README.md | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3b99af6..6e9063a 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,16 @@ in UITableView and UICollectionView.
Lincense

+

+Made with ❤️ by Ryo Aoyama +

+ --- |Declarative|Component-Based|Non-Destructive| |:----------|:--------------|:--------------| |Provides a declarative design with power of diffing algorithm for building list UIs.|Declare component once, it can be reused regardless kind of the list element.|Solves the various problems by architecture and algorithm without destructing UIKit.| -

-Made with ❤️ by Ryo Aoyama -

- --- ## Introduction @@ -37,7 +37,7 @@ This make it painless to build and maintain the complex UIs. Uses [DifferenceKit](https://github.com/ra1028/DifferenceKit) which is highly optimized based on Paul Heckel's paper for diffing. Declarative design and diffing algorithm make your code more predictable, debugging easier and providing beautiful animations to users. -Our goal is similar to [IGListKit](https://github.com/Instagram/IGListKit) and [Epoxy](https://github.com/airbnb/epoxy), we respect those library as pioneers. +Our goal is similar to [Instagram/IGListKit](https://github.com/Instagram/IGListKit) and [airbnb/Epoxy](https://github.com/airbnb/epoxy), we respect those library as pioneers. --- @@ -75,7 +75,7 @@ renderer.render( #### Build for Development -```bash +```sh $ git clone https://github.com/ra1028/Carbon.git $ cd Carbon/ $ make setup @@ -134,7 +134,7 @@ ViewNode(HelloMessage(name: "Vincent")) `CellNode` is a node representing cell. Unlike in the ViewNode, this needs an `id` which `Hashable` type to identify from among a lot of cells. -The `id` is used to find the same component in the list data before and after changed, then calculate the following kind of diff. +The `id` is used to find the same component in the list data before and after changed, then calculate the all kind of diff. - deletes - inserts - moves @@ -154,7 +154,7 @@ CellNode(HelloMessage(name: "Jules")) `Section` has a header, a footer and a group of cells. A group of cells can be contains nil, then skipped rendering of it cell. -This also needs to specify `id` for identify from among multiple sections, then can be calculate the several kind of diff. +This also needs to specify `id` for identify from among multiple sections, then can be calculate the all kind of diff. - section deletes - section inserts - section moves @@ -246,6 +246,10 @@ renderer.render( ) ``` +

+[See More Usage] +

+ --- ## Advanced Guide @@ -389,12 +393,35 @@ Invoked every time of after a component went out from visible area. #### Adapter Customization -You can add methods of `Delegate`, `DataSource` by inheriting each adapter. +You can add methods of `delegate`, `dataSource` by subclassing each adapter. + +```swift +class CustomTableViewdapter: UITableViewAdapter { + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + return "Header title for section\(section)" + } +} + +let renderer = Renderer( + adapter: CustomTableViewdapter(), + updater: UITableViewUpdater() +) +``` + Furthermore, it can be customized the class of the elements(cell/header/footer) which becomes the container of component by setting it to `config`. - **config** The configuration which having the classes of elements. It can be specified only when adapter is initialized. +```swift +let config = UITableViewAdapter.Config( + cellClass: CustomCell.self, + headerViewClass: CustomHeaderView.self, + footerViewClass: CustomFooterView.self +) +let adapter = UITableViewAdapter(config: config) +``` + [See more](https://ra1028.github.io/Carbon/Adapters.html) #### Updater Customization @@ -459,11 +486,7 @@ We recommend to do implementation that doesn't count on this protocols. ### [CocoaPods](https://cocoapods.org) Add the following to your `Podfile`: ```ruby -use_frameworks! - -target 'TargetName' do - pod 'Carbon' -end +pod 'Carbon' ``` ### [Carthage](https://github.com/Carthage/Carthage) From 95fbf017dc3f35a36a6d1f55d263ffeb22973a2a Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 14 May 2019 02:17:15 +0900 Subject: [PATCH 2/7] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 100ed65..492f9d8 100644 --- a/Makefile +++ b/Makefile @@ -11,4 +11,4 @@ lib-lint: bundle exec pod lib lint pod-release: - bundle exec pod trunk push + bundle exec pod trunk push --allow-warnings From a8cf2d45c580a96683980b81b0ff3da9b864dec9 Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 14 May 2019 02:19:51 +0900 Subject: [PATCH 3/7] Update cocoapods --- Gemfile | 2 +- Gemfile.lock | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index d6d1149..9074cfb 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source "https://rubygems.org" -gem 'cocoapods', '1.6.1' +gem 'cocoapods', '1.7.0.rc.1' gem 'jazzy', '0.9.4' diff --git a/Gemfile.lock b/Gemfile.lock index 3d15ae1..fa394b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,11 +9,11 @@ GEM tzinfo (~> 1.1) atomos (0.1.3) claide (1.0.2) - cocoapods (1.6.1) + cocoapods (1.7.0.rc.1) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.1) - cocoapods-deintegrate (>= 1.0.2, < 2.0) + cocoapods-core (= 1.7.0.rc.1) + cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) @@ -27,12 +27,12 @@ GEM molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.8.1, < 2.0) - cocoapods-core (1.6.1) + xcodeproj (>= 1.8.2, < 2.0) + cocoapods-core (1.7.0.rc.1) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.3) + cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap @@ -74,18 +74,18 @@ GEM redcarpet (3.4.0) rouge (3.3.0) ruby-macho (1.4.0) - sass (3.7.3) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sqlite3 (1.4.0) + sqlite3 (1.4.1) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.8.1) + xcodeproj (1.9.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -96,7 +96,7 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.6.1) + cocoapods (= 1.7.0.rc.1) jazzy (= 0.9.4) BUNDLED WITH From cb14bf930f34387911d2da62100436acb8dde8fb Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 14 May 2019 02:37:45 +0900 Subject: [PATCH 4/7] Remove unused script --- scripts/install_swiftlint.sh | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100755 scripts/install_swiftlint.sh diff --git a/scripts/install_swiftlint.sh b/scripts/install_swiftlint.sh deleted file mode 100755 index 75cb143..0000000 --- a/scripts/install_swiftlint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -e - -SWIFTLINT_PKG_PATH="/tmp/SwiftLint.pkg" -SWIFTLINT_PKG_URL="https://github.com/realm/SwiftLint/releases/download/0.30.1/SwiftLint.pkg" - -wget --output-document=$SWIFTLINT_PKG_PATH $SWIFTLINT_PKG_URL - -if [ -f $SWIFTLINT_PKG_PATH ]; then - echo "Installing SwiftLint package..." - sudo installer -pkg $SWIFTLINT_PKG_PATH -target / -else - echo "Compiling SwiftLint from source..." && - git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint && - cd /tmp/SwiftLint && - git submodule update --init --recursive && - sudo make install -fi \ No newline at end of file From 33b01f19847ab92e3c3e580fd51623a52bce08ce Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 14 May 2019 02:39:17 +0900 Subject: [PATCH 5/7] Update podspec --- Carbon.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Carbon.podspec b/Carbon.podspec index 1ed311c..213144a 100644 --- a/Carbon.podspec +++ b/Carbon.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'Carbon' - spec.version = '0.2.0' + spec.version = '0.3.0' spec.author = { 'ra1028' => 'r.fe51028.r@gmail.com' } spec.homepage = 'https://github.com/ra1028/Carbon' spec.documentation_url = 'https://ra1028.github.io/Carbon' @@ -9,7 +9,7 @@ Pod::Spec.new do |spec| spec.source_files = 'Sources/**/*.swift' spec.license = { :type => 'Apache 2.0', :file => 'LICENSE' } spec.requires_arc = true - spec.swift_version = '4.2' + spec.swift_versions = ['4.2', '5.0'] spec.ios.deployment_target = '10.0' spec.dependency 'DifferenceKit/Core', "~> 1.1" spec.ios.frameworks = 'UIKit' From 9b2075e06b745aad68cf27eadbb7486f5ae87551 Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 14 May 2019 02:41:08 +0900 Subject: [PATCH 6/7] Update jazzy --- docs/index.html | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/docs/index.html b/docs/index.html index 31668a7..5bf8b69 100644 --- a/docs/index.html +++ b/docs/index.html @@ -211,6 +211,10 @@

Lincense

+

+Made with ❤️ by Ryo Aoyama +

+
@@ -227,10 +231,6 @@

-

-Made with ❤️ by Ryo Aoyama -

-

Introduction

@@ -240,7 +240,7 @@

Introduction

Uses DifferenceKit which is highly optimized based on Paul Heckel’s paper for diffing.
Declarative design and diffing algorithm make your code more predictable, debugging easier and providing beautiful animations to users.

-

Our goal is similar to IGListKit and Epoxy, we respect those library as pioneers.

+

Our goal is similar to Instagram/IGListKit and airbnb/Epoxy, we respect those library as pioneers.


Examples

@@ -333,7 +333,7 @@

CellNode

CellNode is a node representing cell.
Unlike in the ViewNode, this needs an id which Hashable type to identify from among a lot of cells.
-The id is used to find the same component in the list data before and after changed, then calculate the following kind of diff.

+The id is used to find the same component in the list data before and after changed, then calculate the all kind of diff.

  • deletes
  • @@ -351,7 +351,7 @@

    Section

    Section has a header, a footer and a group of cells.
    A group of cells can be contains nil, then skipped rendering of it cell.
    -This also needs to specify id for identify from among multiple sections, then can be calculate the several kind of diff.

    +This also needs to specify id for identify from among multiple sections, then can be calculate the all kind of diff.

    • section deletes
    • @@ -435,6 +435,10 @@

      Renderer

      ) +

      +[See More Usage] +

      +

      Advanced Guide

      Custom Content

      @@ -559,13 +563,32 @@

      Component in-Depth

      See more

      Adapter Customization

      -

      You can add methods of Delegate, DataSource by inheriting each adapter.
      -Furthermore, it can be customized the class of the elements(cell/header/footer) which becomes the container of component by setting it to config.

      +

      You can add methods of delegate, dataSource by subclassing each adapter.

      +
      class CustomTableViewdapter: UITableViewAdapter {
      +    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
      +        return "Header title for section\(section)"
      +    }
      +}
      +
      +let renderer = Renderer(
      +    adapter: CustomTableViewdapter(),
      +    updater: UITableViewUpdater()
      +)
      +
      + +

      Furthermore, it can be customized the class of the elements(cell/header/footer) which becomes the container of component by setting it to config.

      • config
        The configuration which having the classes of elements. It can be specified only when adapter is initialized.
      +
      let config = UITableViewAdapter.Config(
      +    cellClass: CustomCell.self,
      +    headerViewClass: CustomHeaderView.self,
      +    footerViewClass: CustomFooterView.self
      +)
      +let adapter = UITableViewAdapter(config: config)
      +

      See more

      Updater Customization

      @@ -627,11 +650,7 @@

      Installation

      CocoaPods

      Add the following to your Podfile:

      -
      use_frameworks!
      -
      -target 'TargetName' do
      -  pod 'Carbon'
      -end
      +
      pod 'Carbon'
       

      Carthage

      From 5a482621489ec98c24fcd0b9e2d9940ff9fcdc0c Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 14 May 2019 02:44:35 +0900 Subject: [PATCH 7/7] Fix typo in README --- README.md | 2 +- docs/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e9063a..5639656 100644 --- a/README.md +++ b/README.md @@ -403,7 +403,7 @@ class CustomTableViewdapter: UITableViewAdapter { } let renderer = Renderer( - adapter: CustomTableViewdapter(), + adapter: CustomTableViewAdapter(), updater: UITableViewUpdater() ) ``` diff --git a/docs/index.html b/docs/index.html index 5bf8b69..92820e3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -571,7 +571,7 @@

      Adapter Customization

      } let renderer = Renderer( - adapter: CustomTableViewdapter(), + adapter: CustomTableViewAdapter(), updater: UITableViewUpdater() )