Skip to content

Commit 1109be7

Browse files
author
Luc Dion
authored
Merge pull request #93 from mirego/add_pin_all
Add method that can pin multiples edges
2 parents 5f92ab4 + a1f2869 commit 1109be7

File tree

24 files changed

+317
-115
lines changed

24 files changed

+317
-115
lines changed

.swiftlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ disabled_rules: # rule identifiers to exclude from running
1818
- type_body_length
1919
- cyclomatic_complexity
2020
- nimble_operator
21-
- variable_name
21+
- identifier_name
2222
- line_length
2323

2424
excluded: # paths to ignore during linting. overridden by `included`.

Example/.swiftlint.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
11
opt_in_rules: # some rules are only opt-in
2-
- attributes
32
- closure_end_indentation
43
- closure_spacing
5-
- empty_count
64
- explicit_init
75
- nimble_operator
8-
- number_separator
96
- operator_usage_whitespace
107
- overridden_super_call
118
- private_outlet
129
- prohibited_super_call
1310
- redundant_nil_coalescing
1411

1512
disabled_rules: # rule identifiers to exclude from running
16-
# - function_body_length
13+
- function_body_length
1714
- trailing_whitespace
1815
- force_cast
1916
- type_name
20-
# - todo
2117
- file_length
22-
# - type_body_length
23-
# - valid_docs
24-
# - cyclomatic_complexity
25-
# - nesting
26-
# - function_parameter_count
27-
# - large_tuple
28-
# - variable_name
29-
# - empty_parentheses_with_trailing_closure
18+
- type_body_length
19+
- cyclomatic_complexity
20+
- nimble_operator
21+
- identifier_name
3022
- line_length
3123

3224
excluded: # paths to ignore during linting. overridden by `included`.
3325
- Pods
34-

Example/PinLayoutSample.xcodeproj/project.pbxproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@
409409
isa = PBXProject;
410410
attributes = {
411411
LastSwiftUpdateCheck = 0900;
412-
LastUpgradeCheck = 0820;
412+
LastUpgradeCheck = 0900;
413413
ORGANIZATIONNAME = Mirego;
414414
TargetAttributes = {
415415
249EFE3E1E64FAFE00165E39 = {
@@ -616,15 +616,21 @@
616616
CLANG_CXX_LIBRARY = "libc++";
617617
CLANG_ENABLE_MODULES = YES;
618618
CLANG_ENABLE_OBJC_ARC = YES;
619+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
619620
CLANG_WARN_BOOL_CONVERSION = YES;
621+
CLANG_WARN_COMMA = YES;
620622
CLANG_WARN_CONSTANT_CONVERSION = YES;
621623
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
622624
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
623625
CLANG_WARN_EMPTY_BODY = YES;
624626
CLANG_WARN_ENUM_CONVERSION = YES;
625627
CLANG_WARN_INFINITE_RECURSION = YES;
626628
CLANG_WARN_INT_CONVERSION = YES;
629+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
630+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
627631
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
632+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
633+
CLANG_WARN_STRICT_PROTOTYPES = YES;
628634
CLANG_WARN_SUSPICIOUS_MOVE = YES;
629635
CLANG_WARN_UNREACHABLE_CODE = YES;
630636
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -666,15 +672,21 @@
666672
CLANG_CXX_LIBRARY = "libc++";
667673
CLANG_ENABLE_MODULES = YES;
668674
CLANG_ENABLE_OBJC_ARC = YES;
675+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
669676
CLANG_WARN_BOOL_CONVERSION = YES;
677+
CLANG_WARN_COMMA = YES;
670678
CLANG_WARN_CONSTANT_CONVERSION = YES;
671679
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
672680
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
673681
CLANG_WARN_EMPTY_BODY = YES;
674682
CLANG_WARN_ENUM_CONVERSION = YES;
675683
CLANG_WARN_INFINITE_RECURSION = YES;
676684
CLANG_WARN_INT_CONVERSION = YES;
685+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
686+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
677687
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
688+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
689+
CLANG_WARN_STRICT_PROTOTYPES = YES;
678690
CLANG_WARN_SUSPICIOUS_MOVE = YES;
679691
CLANG_WARN_UNREACHABLE_CODE = YES;
680692
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;

Example/PinLayoutSample.xcodeproj/xcshareddata/xcschemes/PinLayoutSample.xcscheme

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0830"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
</Testables>
@@ -45,6 +46,7 @@
4546
buildConfiguration = "Debug"
4647
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4748
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49+
language = ""
4850
launchStyle = "0"
4951
useCustomWorkingDirectory = "NO"
5052
ignoresPersistentStateOnLaunch = "NO"

Example/PinLayoutSample/UI/Examples/AdjustToContainer/AdjustToContainerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AdjustToContainerView: BaseView {
4444
super.layoutSubviews()
4545

4646
// Layout the contentView using the view's safeArea.
47-
contentView.pin.top().bottom().left().right().margin(safeArea)
47+
contentView.pin.all().margin(safeArea)
4848

4949
languageSelectorView.pin.top().left().right().fitSize()
5050
swiftOpinionSelectorView.pin.below(of: languageSelectorView, aligned: .left).right().marginTop(10).fitSize()

Example/PinLayoutSample/UI/Examples/AdjustToContainer/Subviews/ChoiceSelectorView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ChoiceSelectorView: UIView {
6363
if frame.width > 500 {
6464
// The UISegmentedControl is at the top-right corner and the label takes the remaining horizontal space.
6565
segmentedControl.pin.top().right().margin(margin)
66-
textLabel.pin.top().left().left(of: segmentedControl).margin(margin).fitSize()
66+
textLabel.pin.top().left().before(of: segmentedControl).margin(margin).fitSize()
6767
} else {
6868
// The UISegmentedControl is placed below the label.
6969
textLabel.pin.top().left().right().margin(margin).fitSize()

Example/PinLayoutSample/UI/Examples/AutoAdjustingSizeView/AutoAdjustingSizeView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class AutoAdjustingSizeView: BaseView {
7575
super.layoutSubviews()
7676

7777
// Layout the contentScrollView using the view's safeArea.
78-
contentScrollView.pin.top().bottom().left().right().margin(safeArea)
78+
contentScrollView.pin.all().margin(safeArea)
7979

8080
row1.pin.top().left().right().height(40)
8181
row1Item1.pin.top().left().bottom().width(50).margin(2)
@@ -86,7 +86,7 @@ class AutoAdjustingSizeView: BaseView {
8686
row2Item2.pin.left(of: row2Item1, aligned: .top).left().bottom().margin(0, 2, 2, 2)
8787

8888
row3.pin.below(of: row2, aligned: .left).size(of: row1).marginTop(10)
89-
row3Item1.pin.topCenter().width(50).bottom().margin(2)
89+
row3Item1.pin.topCenter().bottom().width(50).margin(2)
9090
row3Item2.pin.left(of: row3Item1, aligned: .top).left().bottom().margin(0, 2, 2, 2)
9191
row3Item3.pin.right(of: row3Item1, aligned: .top).right().bottom().margin(0, 2, 2, 2)
9292

Example/PinLayoutSample/UI/Examples/Intro/IntroView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ class IntroView: BaseView {
6060

6161
// Layout the contentView using the view's safeArea with at least of 10 pixels all around.
6262
let containerInsets = safeArea.minInsets(UIEdgeInsets(top: 10, left: 10, bottom: 0, right: 10))
63-
contentView.pin.top().bottom().start().end().margin(containerInsets)
63+
contentView.pin.all().margin(containerInsets)
6464

6565
logo.pin.top().left().size(100).aspectRatio().marginTop(10)
66-
segmented.pin.right(of: logo, aligned: .top).right().marginLeft(10)
66+
segmented.pin.after(of: logo, aligned: .top).right().marginLeft(10)
6767
textLabel.pin.below(of: segmented, aligned: .left).width(of: segmented).pinEdges().marginTop(10).fitSize()
6868
separatorView.pin.below(of: [logo, textLabel], aligned: .left).right(to: segmented.edge.right).marginTop(10)
6969
}

Example/PinLayoutSample/UI/Examples/IntroRTL/IntroRTLView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class IntroRTLView: BaseView {
6565

6666
// Layout the contentView using the view's safeArea with at least of 10 pixels all around.
6767
let containerInsets = safeArea.minInsets(UIEdgeInsets(top: 10, left: 10, bottom: 0, right: 10))
68-
contentView.pin.top().bottom().start().end().margin(containerInsets)
68+
contentView.pin.all().margin(containerInsets)
6969

7070
logo.pin.top().start().size(100).aspectRatio().marginTop(10)
7171
segmented.pin.after(of: logo, aligned: .top).end().marginStart(10)

Example/PinLayoutSample/UI/Examples/MultiRelativeView/MultiRelativeView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class MultiRelativeView: BaseView {
4545
super.layoutSubviews()
4646

4747
// Layout the contentView using the view's safeArea.
48-
contentView.pin.top().bottom().left().right().margin(safeArea)
48+
contentView.pin.all().margin(safeArea)
4949

5050
view1.pin.top().left().width(20%).height(50%)
5151
view2.pin.top().right().width(20%).height(50%)

0 commit comments

Comments
 (0)