Skip to content

Commit 571fdfa

Browse files
authored
Merge pull request #19 from ra1028/v0.3.0
Version 0.3.0
2 parents 29ffa26 + 5a48262 commit 571fdfa

File tree

7 files changed

+84
-61
lines changed

7 files changed

+84
-61
lines changed

Carbon.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'Carbon'
3-
spec.version = '0.2.0'
3+
spec.version = '0.3.0'
44
spec.author = { 'ra1028' => 'r.fe51028.r@gmail.com' }
55
spec.homepage = 'https://github.com/ra1028/Carbon'
66
spec.documentation_url = 'https://ra1028.github.io/Carbon'
@@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
99
spec.source_files = 'Sources/**/*.swift'
1010
spec.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
1111
spec.requires_arc = true
12-
spec.swift_version = '4.2'
12+
spec.swift_versions = ['4.2', '5.0']
1313
spec.ios.deployment_target = '10.0'
1414
spec.dependency 'DifferenceKit/Core', "~> 1.1"
1515
spec.ios.frameworks = 'UIKit'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source "https://rubygems.org"
22

3-
gem 'cocoapods', '1.6.1'
3+
gem 'cocoapods', '1.7.0.rc.1'
44
gem 'jazzy', '0.9.4'

Gemfile.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ GEM
99
tzinfo (~> 1.1)
1010
atomos (0.1.3)
1111
claide (1.0.2)
12-
cocoapods (1.6.1)
12+
cocoapods (1.7.0.rc.1)
1313
activesupport (>= 4.0.2, < 5)
1414
claide (>= 1.0.2, < 2.0)
15-
cocoapods-core (= 1.6.1)
16-
cocoapods-deintegrate (>= 1.0.2, < 2.0)
15+
cocoapods-core (= 1.7.0.rc.1)
16+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
1717
cocoapods-downloader (>= 1.2.2, < 2.0)
1818
cocoapods-plugins (>= 1.0.0, < 2.0)
1919
cocoapods-search (>= 1.0.0, < 2.0)
@@ -27,12 +27,12 @@ GEM
2727
molinillo (~> 0.6.6)
2828
nap (~> 1.0)
2929
ruby-macho (~> 1.4)
30-
xcodeproj (>= 1.8.1, < 2.0)
31-
cocoapods-core (1.6.1)
30+
xcodeproj (>= 1.8.2, < 2.0)
31+
cocoapods-core (1.7.0.rc.1)
3232
activesupport (>= 4.0.2, < 6)
3333
fuzzy_match (~> 2.0.4)
3434
nap (~> 1.0)
35-
cocoapods-deintegrate (1.0.3)
35+
cocoapods-deintegrate (1.0.4)
3636
cocoapods-downloader (1.2.2)
3737
cocoapods-plugins (1.0.0)
3838
nap
@@ -74,18 +74,18 @@ GEM
7474
redcarpet (3.4.0)
7575
rouge (3.3.0)
7676
ruby-macho (1.4.0)
77-
sass (3.7.3)
77+
sass (3.7.4)
7878
sass-listen (~> 4.0.0)
7979
sass-listen (4.0.0)
8080
rb-fsevent (~> 0.9, >= 0.9.4)
8181
rb-inotify (~> 0.9, >= 0.9.7)
82-
sqlite3 (1.4.0)
82+
sqlite3 (1.4.1)
8383
thread_safe (0.3.6)
8484
tzinfo (1.2.5)
8585
thread_safe (~> 0.1)
8686
xcinvoke (0.3.0)
8787
liferaft (~> 0.0.6)
88-
xcodeproj (1.8.1)
88+
xcodeproj (1.9.0)
8989
CFPropertyList (>= 2.3.3, < 4.0)
9090
atomos (~> 0.1.3)
9191
claide (>= 1.0.2, < 2.0)
@@ -96,7 +96,7 @@ PLATFORMS
9696
ruby
9797

9898
DEPENDENCIES
99-
cocoapods (= 1.6.1)
99+
cocoapods (= 1.7.0.rc.1)
100100
jazzy (= 0.9.4)
101101

102102
BUNDLED WITH

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ lib-lint:
1111
bundle exec pod lib lint
1212

1313
pod-release:
14-
bundle exec pod trunk push
14+
bundle exec pod trunk push --allow-warnings

README.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ in UITableView and UICollectionView.</br>
1717
<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>
1818
</p>
1919

20+
<p align="center">
21+
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
22+
</p>
23+
2024
---
2125

2226
|Declarative|Component-Based|Non-Destructive|
2327
|:----------|:--------------|:--------------|
2428
|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.|
2529

26-
<p align="right">
27-
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
28-
</p>
29-
3030
---
3131

3232
## Introduction
@@ -37,7 +37,7 @@ This make it painless to build and maintain the complex UIs.
3737
Uses [DifferenceKit](https://github.com/ra1028/DifferenceKit) which is highly optimized based on Paul Heckel's paper for diffing.
3838
Declarative design and diffing algorithm make your code more predictable, debugging easier and providing beautiful animations to users.
3939

40-
Our goal is similar to [IGListKit](https://github.com/Instagram/IGListKit) and [Epoxy](https://github.com/airbnb/epoxy), we respect those library as pioneers.
40+
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.
4141

4242
---
4343

@@ -75,7 +75,7 @@ renderer.render(
7575

7676
#### Build for Development
7777

78-
```bash
78+
```sh
7979
$ git clone https://github.com/ra1028/Carbon.git
8080
$ cd Carbon/
8181
$ make setup
@@ -134,7 +134,7 @@ ViewNode(HelloMessage(name: "Vincent"))
134134

135135
`CellNode` is a node representing cell.
136136
Unlike in the ViewNode, this needs an `id` which `Hashable` type to identify from among a lot of cells.
137-
The `id` is used to find the same component in the list data before and after changed, then calculate the following kind of diff.
137+
The `id` is used to find the same component in the list data before and after changed, then calculate the all kind of diff.
138138
- deletes
139139
- inserts
140140
- moves
@@ -154,7 +154,7 @@ CellNode(HelloMessage(name: "Jules"))
154154

155155
`Section` has a header, a footer and a group of cells.
156156
A group of cells can be contains nil, then skipped rendering of it cell.
157-
This also needs to specify `id` for identify from among multiple sections, then can be calculate the several kind of diff.
157+
This also needs to specify `id` for identify from among multiple sections, then can be calculate the all kind of diff.
158158
- section deletes
159159
- section inserts
160160
- section moves
@@ -246,6 +246,10 @@ renderer.render(
246246
)
247247
```
248248

249+
<H3 align="center">
250+
<a href="https://ra1028.github.io/Carbon">[See More Usage]</a>
251+
</H3>
252+
249253
---
250254

251255
## Advanced Guide
@@ -389,12 +393,35 @@ Invoked every time of after a component went out from visible area.
389393

390394
#### Adapter Customization
391395

392-
You can add methods of `Delegate`, `DataSource` by inheriting each adapter.
396+
You can add methods of `delegate`, `dataSource` by subclassing each adapter.
397+
398+
```swift
399+
class CustomTableViewdapter: UITableViewAdapter {
400+
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
401+
return "Header title for section\(section)"
402+
}
403+
}
404+
405+
let renderer = Renderer(
406+
adapter: CustomTableViewAdapter(),
407+
updater: UITableViewUpdater()
408+
)
409+
```
410+
393411
Furthermore, it can be customized the class of the elements(cell/header/footer) which becomes the container of component by setting it to `config`.
394412

395413
- **config**
396414
The configuration which having the classes of elements. It can be specified only when adapter is initialized.
397415

416+
```swift
417+
let config = UITableViewAdapter.Config(
418+
cellClass: CustomCell.self,
419+
headerViewClass: CustomHeaderView.self,
420+
footerViewClass: CustomFooterView.self
421+
)
422+
let adapter = UITableViewAdapter(config: config)
423+
```
424+
398425
[See more](https://ra1028.github.io/Carbon/Adapters.html)
399426

400427
#### Updater Customization
@@ -459,11 +486,7 @@ We recommend to do implementation that doesn't count on this protocols.
459486
### [CocoaPods](https://cocoapods.org)
460487
Add the following to your `Podfile`:
461488
```ruby
462-
use_frameworks!
463-
464-
target 'TargetName' do
465-
pod 'Carbon'
466-
end
489+
pod 'Carbon'
467490
```
468491

469492
### [Carthage](https://github.com/Carthage/Carthage)

docs/index.html

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ <H4 align="center">
211211
<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>
212212
</p>
213213

214+
<p align="center">
215+
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
216+
</p>
217+
214218
<hr>
215219

216220
<table><thead>
@@ -227,10 +231,6 @@ <H4 align="center">
227231
</tr>
228232
</tbody></table>
229233

230-
<p align="right">
231-
Made with ❤️ by <a href="https://github.com/ra1028">Ryo Aoyama</a>
232-
</p>
233-
234234
<hr>
235235
<h2 id='introduction' class='heading'>Introduction</h2>
236236

@@ -240,7 +240,7 @@ <h2 id='introduction' class='heading'>Introduction</h2>
240240
<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>
241241
Declarative design and diffing algorithm make your code more predictable, debugging easier and providing beautiful animations to users. </p>
242242

243-
<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>
243+
<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>
244244

245245
<hr>
246246
<h2 id='examples' class='heading'>Examples</h2>
@@ -333,7 +333,7 @@ <h4 id='cellnode' class='heading'>CellNode</h4>
333333

334334
<p><code><a href="Structs/CellNode.html">CellNode</a></code> is a node representing cell.<br>
335335
Unlike in the ViewNode, this needs an <code>id</code> which <code>Hashable</code> type to identify from among a lot of cells.<br>
336-
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>
336+
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>
337337

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

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

356356
<ul>
357357
<li>section deletes</li>
@@ -435,6 +435,10 @@ <h4 id='renderer' class='heading'>Renderer</h4>
435435
<span class="p">)</span>
436436
</code></pre>
437437

438+
<H3 align="center">
439+
<a href="https://ra1028.github.io/Carbon">[See More Usage]</a>
440+
</H3>
441+
438442
<hr>
439443
<h2 id='advanced-guide' class='heading'>Advanced Guide</h2>
440444
<h4 id='custom-content' class='heading'>Custom Content</h4>
@@ -559,13 +563,32 @@ <h4 id='component-in-depth' class='heading'>Component in-Depth</h4>
559563
<p><a href="https://ra1028.github.io/Carbon/Protocols/Component.html">See more</a></p>
560564
<h4 id='adapter-customization' class='heading'>Adapter Customization</h4>
561565

562-
<p>You can add methods of <code>Delegate</code>, <code>DataSource</code> by inheriting each adapter.<br>
563-
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>
566+
<p>You can add methods of <code>delegate</code>, <code>dataSource</code> by subclassing each adapter. </p>
567+
<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>
568+
<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>
569+
<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>
570+
<span class="p">}</span>
571+
<span class="p">}</span>
572+
573+
<span class="k">let</span> <span class="nv">renderer</span> <span class="o">=</span> <span class="kt">Renderer</span><span class="p">(</span>
574+
<span class="nv">adapter</span><span class="p">:</span> <span class="kt">CustomTableViewAdapter</span><span class="p">(),</span>
575+
<span class="nv">updater</span><span class="p">:</span> <span class="kt">UITableViewUpdater</span><span class="p">()</span>
576+
<span class="p">)</span>
577+
</code></pre>
578+
579+
<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>
564580

565581
<ul>
566582
<li><strong>config</strong><br>
567583
The configuration which having the classes of elements. It can be specified only when adapter is initialized.<br></li>
568584
</ul>
585+
<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>
586+
<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>
587+
<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>
588+
<span class="nv">footerViewClass</span><span class="p">:</span> <span class="kt">CustomFooterView</span><span class="o">.</span><span class="k">self</span>
589+
<span class="p">)</span>
590+
<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>
591+
</code></pre>
569592

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

629652
<p>Add the following to your <code>Podfile</code>:</p>
630-
<pre class="highlight ruby"><code><span class="n">use_frameworks!</span>
631-
632-
<span class="n">target</span> <span class="s1">'TargetName'</span> <span class="k">do</span>
633-
<span class="n">pod</span> <span class="s1">'Carbon'</span>
634-
<span class="k">end</span>
653+
<pre class="highlight ruby"><code><span class="n">pod</span> <span class="s1">'Carbon'</span>
635654
</code></pre>
636655
<h3 id='a-href-https-github-com-carthage-carthage-carthage-a' class='heading'><a href="https://github.com/Carthage/Carthage">Carthage</a></h3>
637656

scripts/install_swiftlint.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)