Skip to content

Commit dc4e934

Browse files
committed
Add CALayer informations to README
1 parent 549aba4 commit dc4e934

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

PinLayout.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@
223223
C80435D420D0898000EB1BD7 /* Layoutable+PinLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Layoutable+PinLayout.swift"; sourceTree = "<group>"; };
224224
C82DC20B20CE9F6800B7ACF5 /* Layoutable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Layoutable.swift; sourceTree = "<group>"; };
225225
C83588BF20DBC5E600D6E8F9 /* CALayerSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CALayerSpec.swift; sourceTree = "<group>"; };
226+
C83600A520E2949200A3D891 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; usesTabs = 1; };
226227
C8BDEE8FC7F6D6F36D69AE89 /* Pods-PinLayoutTests-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PinLayoutTests-iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PinLayoutTests-iOS/Pods-PinLayoutTests-iOS.debug.xcconfig"; sourceTree = "<group>"; };
227228
C8C4928C20DA7DA700048357 /* CALayer+PinLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CALayer+PinLayout.swift"; sourceTree = "<group>"; };
228229
DF1A5D1D2084C94700725EF5 /* PinLayoutTests-macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "PinLayoutTests-macOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -335,6 +336,7 @@
335336
249EFE701E64FB4C00165E39 = {
336337
isa = PBXGroup;
337338
children = (
339+
C83600A520E2949200A3D891 /* README.md */,
338340
249EFE7C1E64FB4C00165E39 /* Sources */,
339341
249EFE871E64FB4C00165E39 /* Tests */,
340342
249EFE7B1E64FB4C00165E39 /* Products */,

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Extremely Fast views layouting without auto layout. No magic, pure code, full co
3737
* Swift 3.2+ / Swift 4.0 / Objective-C
3838

3939
### Recent changes/features
40+
* :star: PinLayout can now layout CALayer. See [CALayer Support](#calayer_support) for more information.
41+
4042
* :star: PinLayout has moved to the **[layoutBox](https://github.com/layoutBox)** organization. See other **[layoutBox](https://github.com/layoutBox)** projects.
4143

4244
* :star: Add `wrapContent()` methods that adjust view's width and height to wrap all its subviews. See [wrapContent](#wrapContent) for more information.
@@ -72,6 +74,7 @@ Extremely Fast views layouting without auto layout. No magic, pure code, full co
7274
* [More examples](#more_examples)
7375
* [Examples App](#examples_app)
7476
* [macOS Support](#macos_support)
77+
* [CALayer Support](#calayer_support)
7578
* [PinLayout in Xcode Playgrounds](#playgrounds)
7679
* [PinLayout using Objective-C](#objective_c_interface)
7780
* [Installation](#installation)
@@ -1543,8 +1546,10 @@ PinLayout **support of macOS is not complete**, see here the particularities of
15431546

15441547
* These methods are currently not supported on macOS, but they will be implemented soon:
15451548

1546-
* [`sizeToFit(:FitType)`](#sizeToFit) (Coming soon)
1549+
* [`sizeToFit(:FitType)`](#sizeToFit) on any view that is not a subclass of NSControl
15471550
* [`aspectRatio()`](#aspect_ratio) with no parameters (Coming soon)
1551+
1552+
* Support for [`sizeToFit(:FitType)`](#sizeToFit) can be added to your custom NSView subclasses. Just make those views conform to the `SizeCalculable` protocol and implement the two required functions.
15481553

15491554

15501555
* [`UIView.pin.safeArea`](#safeAreaInsets) property is not available, AppKit doesn't have an UIView.safeAreaInsets equivalent.
@@ -1553,6 +1558,35 @@ All other PinLayout's methods and properties are available on macOS!
15531558

15541559
<br>
15551560

1561+
1562+
<a name="calayer_support"></a>
1563+
## CALayer Support
1564+
1565+
PinLayout can also layouts **CALayer**'s. All PinLayout's properties and methods are available, with the following exceptions:
1566+
1567+
* These methods are currently not supported for CALayers
1568+
1569+
* [`sizeToFit(:FitType)`](#sizeToFit) is not supported.
1570+
* [`aspectRatio()`](#aspect_ratio) with no parameters.
1571+
* [`CALayer.pin.safeArea`](#safeAreaInsets)
1572+
1573+
* Support for [`sizeToFit(:FitType)`](#sizeToFit) can be added to your custom CALayer subclasses. Just make those layers conform to the `SizeCalculable` protocol and implement the two required functions.
1574+
1575+
###### Usage Examples:
1576+
1577+
```swift
1578+
aLayer = CALayer()
1579+
bLayer = CALayer()
1580+
view.layer.addSublayer(aLayer)
1581+
view.layer.addSublayer(bLayer)
1582+
...
1583+
1584+
aLayer.pin.top(10).left(10).width(20%).height(80%)
1585+
bLayer.pin.below(of: aLayer, aligned: .left).size(of: aLayer)
1586+
```
1587+
1588+
<br>
1589+
15561590
<a name="playgrounds"></a>
15571591
## PinLayout in Xcode Playgrounds
15581592

0 commit comments

Comments
 (0)