Skip to content

Commit

Permalink
Merge pull request #19 from ra1028/v0.3.0
Browse files Browse the repository at this point in the history
Version 0.3.0
  • Loading branch information
ra1028 authored May 13, 2019
2 parents 29ffa26 + 5a48262 commit 571fdfa
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Carbon.podspec
Original file line number Diff line number Diff line change
@@ -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' => '[email protected]' }
spec.homepage = 'https://github.com/ra1028/Carbon'
spec.documentation_url = 'https://ra1028.github.io/Carbon'
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -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'
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -96,7 +96,7 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.6.1)
cocoapods (= 1.7.0.rc.1)
jazzy (= 0.9.4)

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
51 changes: 37 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ in UITableView and UICollectionView.</br>
<a href="https://github.com/ra1028/Carbon/blob/master/LICENSE"><img alt="Lincense" src="https://img.shields.io/badge/License-Apache%202.0-black.svg"/></a>
</p>

<p align="center">
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
</p>

---

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

<p align="right">
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
</p>

---

## Introduction
Expand All @@ -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.

---

Expand Down Expand Up @@ -75,7 +75,7 @@ renderer.render(

#### Build for Development

```bash
```sh
$ git clone https://github.com/ra1028/Carbon.git
$ cd Carbon/
$ make setup
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -246,6 +246,10 @@ renderer.render(
)
```

<H3 align="center">
<a href="https://ra1028.github.io/Carbon">[See More Usage]</a>
</H3>

---

## Advanced Guide
Expand Down Expand Up @@ -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: CustomTableViewAdapter(),
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
Expand Down Expand Up @@ -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)
Expand Down
47 changes: 33 additions & 14 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ <H4 align="center">
<a href="https://github.com/ra1028/Carbon/blob/master/LICENSE"><img alt="Lincense" src="https://img.shields.io/badge/License-Apache%202.0-black.svg"/></a>
</p>

<p align="center">
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
</p>

<hr>

<table><thead>
Expand All @@ -227,10 +231,6 @@ <H4 align="center">
</tr>
</tbody></table>

<p align="right">
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
</p>

<hr>
<h2 id='introduction' class='heading'>Introduction</h2>

Expand All @@ -240,7 +240,7 @@ <h2 id='introduction' class='heading'>Introduction</h2>
<p>Uses <a href="https://github.com/ra1028/DifferenceKit">DifferenceKit</a> which is highly optimized based on Paul Heckel&rsquo;s paper for diffing.<br>
Declarative design and diffing algorithm make your code more predictable, debugging easier and providing beautiful animations to users. </p>

<p>Our goal is similar to <a href="https://github.com/Instagram/IGListKit">IGListKit</a> and <a href="https://github.com/airbnb/epoxy">Epoxy</a>, we respect those library as pioneers. </p>
<p>Our goal is similar to <a href="https://github.com/Instagram/IGListKit">Instagram/IGListKit</a> and <a href="https://github.com/airbnb/epoxy">airbnb/Epoxy</a>, we respect those library as pioneers. </p>

<hr>
<h2 id='examples' class='heading'>Examples</h2>
Expand Down Expand Up @@ -333,7 +333,7 @@ <h4 id='cellnode' class='heading'>CellNode</h4>

<p><code><a href="Structs/CellNode.html">CellNode</a></code> is a node representing cell.<br>
Unlike in the ViewNode, this needs an <code>id</code> which <code>Hashable</code> type to identify from among a lot of cells.<br>
The <code>id</code> is used to find the same component in the list data before and after changed, then calculate the following kind of diff. </p>
The <code>id</code> is used to find the same component in the list data before and after changed, then calculate the all kind of diff. </p>

<ul>
<li>deletes</li>
Expand All @@ -351,7 +351,7 @@ <h4 id='section' class='heading'>Section</h4>

<p><code><a href="Structs/Section.html">Section</a></code> has a header, a footer and a group of cells.<br>
A group of cells can be contains nil, then skipped rendering of it cell.<br>
This also needs to specify <code>id</code> for identify from among multiple sections, then can be calculate the several kind of diff. </p>
This also needs to specify <code>id</code> for identify from among multiple sections, then can be calculate the all kind of diff. </p>

<ul>
<li>section deletes</li>
Expand Down Expand Up @@ -435,6 +435,10 @@ <h4 id='renderer' class='heading'>Renderer</h4>
<span class="p">)</span>
</code></pre>

<H3 align="center">
<a href="https://ra1028.github.io/Carbon">[See More Usage]</a>
</H3>

<hr>
<h2 id='advanced-guide' class='heading'>Advanced Guide</h2>
<h4 id='custom-content' class='heading'>Custom Content</h4>
Expand Down Expand Up @@ -559,13 +563,32 @@ <h4 id='component-in-depth' class='heading'>Component in-Depth</h4>
<p><a href="https://ra1028.github.io/Carbon/Protocols/Component.html">See more</a></p>
<h4 id='adapter-customization' class='heading'>Adapter Customization</h4>

<p>You can add methods of <code>Delegate</code>, <code>DataSource</code> by inheriting each adapter.<br>
Furthermore, it can be customized the class of the elements(cell/header/footer) which becomes the container of component by setting it to <code>config</code>. </p>
<p>You can add methods of <code>delegate</code>, <code>dataSource</code> by subclassing each adapter. </p>
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">CustomTableViewdapter</span><span class="p">:</span> <span class="kt">UITableViewAdapter</span> <span class="p">{</span>
<span class="kd">func</span> <span class="nf">tableView</span><span class="p">(</span><span class="n">_</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">UITableView</span><span class="p">,</span> <span class="n">titleForHeaderInSection</span> <span class="nv">section</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">String</span><span class="p">?</span> <span class="p">{</span>
<span class="k">return</span> <span class="s">"Header title for section</span><span class="se">\(</span><span class="n">section</span><span class="se">)</span><span class="s">"</span>
<span class="p">}</span>
<span class="p">}</span>

<span class="k">let</span> <span class="nv">renderer</span> <span class="o">=</span> <span class="kt">Renderer</span><span class="p">(</span>
<span class="nv">adapter</span><span class="p">:</span> <span class="kt">CustomTableViewAdapter</span><span class="p">(),</span>
<span class="nv">updater</span><span class="p">:</span> <span class="kt">UITableViewUpdater</span><span class="p">()</span>
<span class="p">)</span>
</code></pre>

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

<ul>
<li><strong>config</strong><br>
The configuration which having the classes of elements. It can be specified only when adapter is initialized.<br></li>
</ul>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">config</span> <span class="o">=</span> <span class="kt">UITableViewAdapter</span><span class="o">.</span><span class="kt">Config</span><span class="p">(</span>
<span class="nv">cellClass</span><span class="p">:</span> <span class="kt">CustomCell</span><span class="o">.</span><span class="k">self</span><span class="p">,</span>
<span class="nv">headerViewClass</span><span class="p">:</span> <span class="kt">CustomHeaderView</span><span class="o">.</span><span class="k">self</span><span class="p">,</span>
<span class="nv">footerViewClass</span><span class="p">:</span> <span class="kt">CustomFooterView</span><span class="o">.</span><span class="k">self</span>
<span class="p">)</span>
<span class="k">let</span> <span class="nv">adapter</span> <span class="o">=</span> <span class="kt">UITableViewAdapter</span><span class="p">(</span><span class="nv">config</span><span class="p">:</span> <span class="n">config</span><span class="p">)</span>
</code></pre>

<p><a href="https://ra1028.github.io/Carbon/Adapters.html">See more</a></p>
<h4 id='updater-customization' class='heading'>Updater Customization</h4>
Expand Down Expand Up @@ -627,11 +650,7 @@ <h2 id='installation' class='heading'>Installation</h2>
<h3 id='a-href-https-cocoapods-org-cocoapods-a' class='heading'><a href="https://cocoapods.org">CocoaPods</a></h3>

<p>Add the following to your <code>Podfile</code>:</p>
<pre class="highlight ruby"><code><span class="n">use_frameworks!</span>

<span class="n">target</span> <span class="s1">'TargetName'</span> <span class="k">do</span>
<span class="n">pod</span> <span class="s1">'Carbon'</span>
<span class="k">end</span>
<pre class="highlight ruby"><code><span class="n">pod</span> <span class="s1">'Carbon'</span>
</code></pre>
<h3 id='a-href-https-github-com-carthage-carthage-carthage-a' class='heading'><a href="https://github.com/Carthage/Carthage">Carthage</a></h3>

Expand Down
19 changes: 0 additions & 19 deletions scripts/install_swiftlint.sh

This file was deleted.

0 comments on commit 571fdfa

Please sign in to comment.