Skip to content

Commit

Permalink
Merge branch 'develop' into release/0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
g-mark committed Feb 11, 2021
2 parents 753e672 + e90f8f0 commit 73be02c
Show file tree
Hide file tree
Showing 59 changed files with 488 additions and 170 deletions.
30 changes: 15 additions & 15 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# Find all the available rules by running:
# swiftlint rules

# rules to exclude from running
disabled_rules:
disabled_rules: # rule identifiers to exclude from running
- identifier_name
- line_length
- no_extension_access_modifier
- statement_position # a.k.a. cuddled else
- statement_position
- shorthand_operator
- multiple_closures_with_trailing_closure

# rules that must run
opt_in_rules:
opt_in_rules: # some rules are only opt-in
- anyobject_protocol
- collection_alignment
- closure_spacing
Expand All @@ -34,6 +34,7 @@ opt_in_rules:
- empty_string
- empty_xctest_method
- explicit_init
- first_where
- force_cast
- force_try
- force_unwrapping
Expand All @@ -47,6 +48,7 @@ opt_in_rules:
- multiline_parameters
- no_space_in_method_call
- opening_brace
- operator_usage_whitespace
- overridden_super_call
- prohibited_super_call
- redundant_discardable_let
Expand All @@ -70,10 +72,6 @@ custom_rules:
name: "No space after opening parentheses"
message: "Please avoid using space after opening parentheses"
regex: '\(\h+'
no_space_before_closing_parentheses:
name: "No space before closing parentheses"
message: "Please avoid using space before closing parentheses"
regex: '\h+\)'

anonymous_init:
name: "Anonymous init()"
Expand Down Expand Up @@ -105,8 +103,6 @@ function_parameter_count:
warning: 6
error: 9

line_length: 160

nesting:
type_level:
warning: 3 # default is 1
Expand All @@ -116,18 +112,22 @@ trailing_whitespace:

type_body_length:
warning: 500 # default is 200
error: 600 # default is 350
error: 1000 # default is 350

unused_setter_value: error


#---
#--- Paths

#included: # paths to include during linting. `--path` is ignored if present.
# - ../Pod
# In ios-common-config, the path to the sources will be done via the --path argument

# excluded: # paths to ignore during linting. Takes precedence over `included`.
# - ./vendor
# - ./fastlane
excluded: # paths to ignore during linting. Takes precedence over `included`.
- ./Example/Pods
- ./Pods
- ./vendor
- ./fastlane

reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
6 changes: 3 additions & 3 deletions Sources/WWLayout/Anchorable.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//
// Anchorable.swift
//
Expand All @@ -11,7 +11,7 @@
//
// https://github.com/ww-tech/wwlayout
//
// Copyright © 2017-2018 WW International, Inc.
// Copyright © 2017-2021 WW International, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//

import UIKit
Expand Down
6 changes: 3 additions & 3 deletions Sources/WWLayout/Insets.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//
// Insets.swift
//
Expand All @@ -11,7 +11,7 @@
//
// https://github.com/ww-tech/wwlayout
//
// Copyright © 2017-2018 WW International, Inc.
// Copyright © 2017-2021 WW International, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//

import UIKit
Expand Down
6 changes: 3 additions & 3 deletions Sources/WWLayout/Layout+Activate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//
// Layout+Activate.swift
//
Expand All @@ -11,7 +11,7 @@
//
// https://github.com/ww-tech/wwlayout
//
// Copyright © 2017-2018 WW International, Inc.
// Copyright © 2017-2021 WW International, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//

import UIKit
Expand Down
6 changes: 3 additions & 3 deletions Sources/WWLayout/Layout+Center.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//
// Layout+Center.swift
//
Expand All @@ -11,7 +11,7 @@
//
// https://github.com/ww-tech/wwlayout
//
// Copyright © 2017-2018 WW International, Inc.
// Copyright © 2017-2021 WW International, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//

import UIKit
Expand Down
6 changes: 3 additions & 3 deletions Sources/WWLayout/Layout+Edges.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//
// Layout+Edges.swift
//
Expand All @@ -11,7 +11,7 @@
//
// https://github.com/ww-tech/wwlayout
//
// Copyright © 2017-2018 WW International, Inc.
// Copyright © 2017-2021 WW International, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//

import UIKit
Expand Down
118 changes: 115 additions & 3 deletions Sources/WWLayout/Layout+Fill.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//
// Layout+Fill.swift
//
Expand All @@ -11,7 +11,7 @@
//
// https://github.com/ww-tech/wwlayout
//
// Copyright © 2017-2018 WW International, Inc.
// Copyright © 2017-2021 WW International, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------===//
//

import UIKit
Expand Down Expand Up @@ -66,6 +66,18 @@ extension Layout {
active: Bool? = nil) -> Layout {
return fill(other, axis: axis, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

/// Set the view so it fills another view.
/// Will constrain the edges (left, top, bottom, right) of the target view to the edges of `otherView`, based on the `axis` parameter.
@discardableResult
public func fill(_ other: Anchorable,
axis: LayoutAxis = .xy,
inset: UIEdgeInsets,
priority: LayoutPriority? = nil,
tag: Int? = nil,
active: Bool? = nil) -> Layout {
return fill(other, axis: axis, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

/// Set the view so it fills special anchors.
/// Will constrain the edges (left, top, bottom, right) of the target view to the edges of `special`, based on the `axis` parameter.
Expand All @@ -90,6 +102,18 @@ extension Layout {
active: Bool? = nil) -> Layout {
return fill(special, axis: axis, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

/// Set the view so it fills another view.
/// Will constrain the edges (left, top, bottom, right) of the target view to the edges of `otherView`, based on the `axis` parameter.
@discardableResult
public func fill(_ special: SpecialAnchorable,
axis: LayoutAxis = .xy,
inset: UIEdgeInsets,
priority: LayoutPriority? = nil,
tag: Int? = nil,
active: Bool? = nil) -> Layout {
return fill(special, axis: axis, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

// MARK: - Fill except one edge

Expand Down Expand Up @@ -129,6 +153,18 @@ extension Layout {
active: Bool? = nil) -> Layout {
return fill(other, except: except, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

/// Set the view so it fills another view - excluding one edge.
/// Will constrain the edges (left, top, bottom, right) of the target view to the edges of `otherView`, based on the `axis` parameter.
@discardableResult
public func fill(_ other: Anchorable,
except: LayoutFillEdge,
inset: UIEdgeInsets,
priority: LayoutPriority? = nil,
tag: Int? = nil,
active: Bool? = nil) -> Layout {
return fill(other, except: except, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

/// Set the view so it fills special anchors - excluding one edge.
/// Will constrain the edges (left, top, bottom, right) of the target view to the edges of `special`, based on the `axis` parameter.
Expand All @@ -153,6 +189,18 @@ extension Layout {
active: Bool? = nil) -> Layout {
return fill(special, except: except, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

/// Set the view so it fills another view - excluding one edge.
/// Will constrain the edges (left, top, bottom, right) of the target view to the edges of `otherView`, based on the `axis` parameter.
@discardableResult
public func fill(_ special: SpecialAnchorable,
except: LayoutFillEdge,
inset: UIEdgeInsets,
priority: LayoutPriority? = nil,
tag: Int? = nil,
active: Bool? = nil) -> Layout {
return fill(special, except: except, inset: Insets(inset), priority: priority, tag: tag, active: active)
}

// MARK: - Fill width with maximum

Expand Down Expand Up @@ -199,6 +247,22 @@ extension Layout {
return fillWidth(of: other, inset: Insets(inset), maximum: maximum, alignTo: edge, priority: priority, tag: tag, active: active)
}

/// Set the view so it fills the width of another view, with a maximum allowed width.
/// Will constrain:
/// the left & right edges of the target view to the edges of `other` at `priority` - 1;
/// the width to be <= `maximum`
/// the `alignTo` edge to the same ot `other`.
@discardableResult
public func fillWidth(of other: Anchorable,
inset: UIEdgeInsets,
maximum: CGFloat,
alignTo edge: LayoutXEdge = .center,
priority: LayoutPriority? = nil,
tag: Int? = nil,
active: Bool? = nil) -> Layout {
return fillWidth(of: other, inset: Insets(inset), maximum: maximum, alignTo: edge, priority: priority, tag: tag, active: active)
}

/// Set the view so it fills the width of another view, with a maximum allowed width.
/// Will constrain:
/// the left & right edges of the target view to the edges of `special` at `priority` - 1;
Expand All @@ -214,5 +278,53 @@ extension Layout {
active: Bool? = nil) -> Layout {
return fillWidth(of: special.anchorable(with: view), inset: inset, maximum: maximum, alignTo: edge, priority: priority, tag: tag, active: active)
}

/// Set the view so it fills the width of another view, with a maximum allowed width.
/// Will constrain:
/// the left & right edges of the target view to the edges of `special` at `priority` - 1;
/// the width to be <= `maximum`
/// the `alignTo` edge to the same of `special`.
@discardableResult
public func fillWidth(of special: SpecialAnchorable,
inset: CGFloat,
maximum: CGFloat,
alignTo edge: LayoutXEdge = .center,
priority: LayoutPriority? = nil,
tag: Int? = nil,
active: Bool? = nil) -> Layout {
return fillWidth(
of: special.anchorable(with: view),
inset: Insets(inset),
maximum: maximum,
alignTo: edge,
priority: priority,
tag: tag,
active: active
)
}

/// Set the view so it fills the width of another view, with a maximum allowed width.
/// Will constrain:
/// the left & right edges of the target view to the edges of `special` at `priority` - 1;
/// the width to be <= `maximum`
/// the `alignTo` edge to the same of `special`.
@discardableResult
public func fillWidth(of special: SpecialAnchorable,
inset: UIEdgeInsets,
maximum: CGFloat,
alignTo edge: LayoutXEdge = .center,
priority: LayoutPriority? = nil,
tag: Int? = nil,
active: Bool? = nil) -> Layout {
return fillWidth(
of: special.anchorable(with: view),
inset: Insets(inset),
maximum: maximum,
alignTo: edge,
priority: priority,
tag: tag,
active: active
)
}

}
Loading

0 comments on commit 73be02c

Please sign in to comment.