Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Sources/StackKit/HStackLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ open class HStackLayer: CALayer {
}
}

public func addContent(@_StackKitHStackLayerContentResultBuilder _ content: () -> [CALayer]) {
for v in content() {
addSublayer(v)
}
}

public func resetContent(@_StackKitHStackLayerContentResultBuilder _ content: () -> [CALayer]) {
sublayers?.forEach { $0.removeFromSuperlayer() }
for v in content() {
addSublayer(v)
}
}

open var effectiveSublayers: [CALayer] {
(sublayers ?? []).lazy.filter { $0._isEffectiveLayer }
}
Expand Down
13 changes: 13 additions & 0 deletions Sources/StackKit/HStackLayerWrapperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ open class HStackLayerWrapperView: UIView {
super.init(coder: coder)
}

public func addContent(@_StackKitHStackContentResultBuilder _ content: () -> [UIView]) {
for v in content() {
addSubview(v)
}
}

public func resetContent(@_StackKitHStackContentResultBuilder _ content: () -> [UIView]) {
subviews.forEach { $0.removeFromSuperview() }
for v in content() {
addSubview(v)
}
}

open override class var layerClass: AnyClass {
HStackLayer.self
}
Expand Down
13 changes: 13 additions & 0 deletions Sources/StackKit/HStackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ open class HStackView: UIView {
super.init(coder: coder)
}

public func addContent(@_StackKitHStackContentResultBuilder _ content: () -> [UIView]) {
for v in content() {
addSubview(v)
}
}

public func resetContent(@_StackKitHStackContentResultBuilder _ content: () -> [UIView]) {
subviews.forEach { $0.removeFromSuperview() }
for v in content() {
addSubview(v)
}
}

open override func didAddSubview(_ subview: UIView) {
super.didAddSubview(subview)

Expand Down
13 changes: 13 additions & 0 deletions Sources/StackKit/VStackLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ open class VStackLayer: CALayer {
}
}

public func addContent(@_StackKitVStackLayerContentResultBuilder _ content: () -> [CALayer]) {
for v in content() {
addSublayer(v)
}
}

public func resetContent(@_StackKitVStackLayerContentResultBuilder _ content: () -> [CALayer]) {
sublayers?.forEach { $0.removeFromSuperlayer() }
for v in content() {
addSublayer(v)
}
}

open var effectiveSublayers: [CALayer] {
(sublayers ?? []).lazy.filter { $0._isEffectiveLayer }
}
Expand Down
13 changes: 13 additions & 0 deletions Sources/StackKit/VStackLayerWrapperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ open class VStackLayerWrapperView: UIView {
super.init(coder: coder)
}

public func addContent(@_StackKitVStackContentResultBuilder _ content: () -> [UIView]) {
for v in content() {
addSubview(v)
}
}

public func resetContent(@_StackKitVStackContentResultBuilder _ content: () -> [UIView]) {
subviews.forEach { $0.removeFromSuperview() }
for v in content() {
addSubview(v)
}
}

open override class var layerClass: AnyClass {
VStackLayer.self
}
Expand Down
13 changes: 13 additions & 0 deletions Sources/StackKit/VStackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ open class VStackView: UIView {
super.init(coder: coder)
}

public func addContent(@_StackKitVStackContentResultBuilder _ content: () -> [UIView]) {
for v in content() {
addSubview(v)
}
}

public func resetContent(@_StackKitVStackContentResultBuilder _ content: () -> [UIView]) {
subviews.forEach { $0.removeFromSuperview() }
for v in content() {
addSubview(v)
}
}

open override func didAddSubview(_ subview: UIView) {
super.didAddSubview(subview)

Expand Down
13 changes: 13 additions & 0 deletions Sources/StackKit/WrapStackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ open class WrapStackView: UIView {
super.init(coder: coder)
}

public func addContent(@_StackKitWrapStackContentResultBuilder _ content: () -> [UIView]) {
for v in content() {
addSubview(v)
}
}

public func resetContent(@_StackKitWrapStackContentResultBuilder _ content: () -> [UIView]) {
subviews.forEach { $0.removeFromSuperview() }
for v in content() {
addSubview(v)
}
}

public var effectiveSubviews: [UIView] {
subviews.filter { $0._isEffectiveView }
}
Expand Down