Skip to content

Commit 2345e52

Browse files
committed
Update README & doc
1 parent 09f2770 commit 2345e52

File tree

5 files changed

+78
-5
lines changed

5 files changed

+78
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<p align="center">
12
<img src="https://raw.githubusercontent.com/ra1028/Carbon/master/assets/logo/png/logo_carbon_bnr3_white.png" width=700>
23
</p>
34

@@ -324,7 +325,7 @@ struct HelloMessage: IdentifiableComponent {
324325

325326
Components made with `Carbon` are compatible with `SwiftUI`.
326327
The component can easily works as SwiftUI by composing with `View` protocol.
327-
However, SwiftUI doesn't support self-sizing by auto layout, so we need to specify the height explicitly by `Component.referenceSize(in:)` or `View.frame(height:)`.
328+
Currently SwiftUI doesn't support self-sizing, so can use `UIView.intrinsicContentSize` or specify the height explicitly by `Component.referenceSize(in:)` or `View.frame(height:)`.
328329

329330
```swift
330331
struct HelloMessage: Component, View {

docs/Protocols/Component.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,45 @@ <h4>Parameters</h4>
653653
</section>
654654
</div>
655655
</li>
656+
<li class="item">
657+
<div>
658+
<code>
659+
<a name="/s:6Carbon9ComponentP20intrinsicContentSize3forSo6CGSizeV0D0Qz_tF"></a>
660+
<a name="//apple_ref/swift/Method/intrinsicContentSize(for:)" class="dashAnchor"></a>
661+
<a class="token" href="#/s:6Carbon9ComponentP20intrinsicContentSize3forSo6CGSizeV0D0Qz_tF">intrinsicContentSize(for:)</a>
662+
</code>
663+
<span class="declaration-note">
664+
Default implementation
665+
</span>
666+
</div>
667+
<div class="height-container">
668+
<div class="pointer-container"></div>
669+
<section class="section">
670+
<div class="pointer"></div>
671+
<div class="abstract">
672+
<p>The natural size for the passed content.</p>
673+
674+
</div>
675+
<h4>Default Implementation</h4>
676+
<div class="default_impl abstract">
677+
<p>The natural size for the passed content.</p>
678+
679+
</div>
680+
<div class="declaration">
681+
<h4>Declaration</h4>
682+
<div class="language">
683+
<p class="aside-title">Swift</p>
684+
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">intrinsicContentSize</span><span class="p">(</span><span class="k">for</span> <span class="nv">content</span><span class="p">:</span> <span class="kt"><a href="../Protocols/Component.html#/s:6Carbon9ComponentP7ContentQa">Content</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">CGSize</span></code></pre>
685+
686+
</div>
687+
</div>
688+
<div>
689+
<h4>Return Value</h4>
690+
<p>A <code>CGSize</code> value represents a natural size of the passed content.</p>
691+
</div>
692+
</section>
693+
</div>
694+
</li>
656695
</ul>
657696
</div>
658697
<div class="task-group">

docs/Structs/AnyComponent.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,38 @@ <h4>Parameters</h4>
595595
</section>
596596
</div>
597597
</li>
598+
<li class="item">
599+
<div>
600+
<code>
601+
<a name="/s:6Carbon12AnyComponentV20intrinsicContentSize3forSo6CGSizeVyp_tF"></a>
602+
<a name="//apple_ref/swift/Method/intrinsicContentSize(for:)" class="dashAnchor"></a>
603+
<a class="token" href="#/s:6Carbon12AnyComponentV20intrinsicContentSize3forSo6CGSizeVyp_tF">intrinsicContentSize(for:)</a>
604+
</code>
605+
</div>
606+
<div class="height-container">
607+
<div class="pointer-container"></div>
608+
<section class="section">
609+
<div class="pointer"></div>
610+
<div class="abstract">
611+
<p>The natural size for the passed content.</p>
612+
613+
</div>
614+
<div class="declaration">
615+
<h4>Declaration</h4>
616+
<div class="language">
617+
<p class="aside-title">Swift</p>
618+
<pre class="highlight swift"><code><span class="kd">@inlinable</span>
619+
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">intrinsicContentSize</span><span class="p">(</span><span class="k">for</span> <span class="nv">content</span><span class="p">:</span> <span class="kt">Any</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">CGSize</span></code></pre>
620+
621+
</div>
622+
</div>
623+
<div>
624+
<h4>Return Value</h4>
625+
<p>A <code>CGSize</code> value represents a natural size of the passed content.</p>
626+
</div>
627+
</section>
628+
</div>
629+
</li>
598630
<li class="item">
599631
<div>
600632
<code>

docs/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@
215215
<section class="section">
216216
<div class="section-content">
217217

218-
<p><img src="https://raw.githubusercontent.com/ra1028/Carbon/master/assets/logo/png/logo_carbon_bnr3_white.png" width=700>
219-
</p></p>
218+
<p align="center">
219+
<img src="https://raw.githubusercontent.com/ra1028/Carbon/master/assets/logo/png/logo_carbon_bnr3_white.png" width=700>
220+
</p>
220221

221222
<H4 align="center">
222223
A declarative library for building component-based user interfaces</br>
@@ -526,7 +527,7 @@ <h3 id='swiftui-compatibility' class='heading'>SwiftUI Compatibility</h3>
526527

527528
<p>Components made with <code>Carbon</code> are compatible with <code>SwiftUI</code>.<br>
528529
The component can easily works as SwiftUI by composing with <code>View</code> protocol.<br>
529-
However, SwiftUI doesn&rsquo;t support self-sizing by auto layout, so we need to specify the height explicitly by <code><a href="Protocols/Component.html#/s:6Carbon9ComponentP13referenceSize2inSo6CGSizeVSgSo6CGRectV_tF">Component.referenceSize(in:)</a></code> or <code>View.frame(height:)</code>. </p>
530+
Currently SwiftUI doesn&rsquo;t support self-sizing, so can use <code>UIView.intrinsicContentSize</code> or specify the height explicitly by <code><a href="Protocols/Component.html#/s:6Carbon9ComponentP13referenceSize2inSo6CGSizeVSgSo6CGRectV_tF">Component.referenceSize(in:)</a></code> or <code>View.frame(height:)</code>. </p>
530531
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">HelloMessage</span><span class="p">:</span> <span class="kt">Component</span><span class="p">,</span> <span class="kt">View</span> <span class="p">{</span>
531532
<span class="o">...</span>
532533
<span class="p">}</span>

docs/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)