Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/2024 07 16 #61

Merged
merged 5 commits into from
Jul 16, 2024
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
20 changes: 17 additions & 3 deletions Sources/Core/Extensions/UICollectionView+RAK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ extension Extendable where Base: UICollectionView {

extension Extendable where Base: UICollectionView {
public func deselectRowIfNeeded(
with transitionCoordinator: UIViewControllerTransitionCoordinator? = nil,
animated: Bool = true,
after deadline: DispatchTime? = nil
) {
if let deadline {
DispatchQueue.main.asyncAfter(deadline: deadline) {
deselectRowIfNeeded(with: transitionCoordinator, animated: animated)
}
} else {
deselectRowIfNeeded(with: transitionCoordinator, animated: animated)
}
}

private func deselectRowIfNeeded(
with transitionCoordinator: UIViewControllerTransitionCoordinator?,
animated: Bool
) {
Expand All @@ -46,19 +60,19 @@ extension Extendable where Base: UICollectionView {
alongsideTransition: { _ in
deselectItems(at: selectedIndexPaths, animated: true)
},
completion: { context in
completion: { [weak base] context in
guard context.isCancelled else { return }

for selectedIndexPath in selectedIndexPaths {
base.selectItem(at: selectedIndexPath, animated: false, scrollPosition: [])
base?.selectItem(at: selectedIndexPath, animated: false, scrollPosition: [])
}
}
)
}

private func deselectItems(at selectedIndexPaths: [IndexPath], animated: Bool) {
for selectedIndexPath in selectedIndexPaths {
base.deselectItem(at: selectedIndexPath, animated: true)
base.deselectItem(at: selectedIndexPath, animated: animated)
base.delegate?.collectionView?(base, didDeselectItemAt: selectedIndexPath)
}
}
Expand Down
22 changes: 18 additions & 4 deletions Sources/Core/Extensions/UITableView+RAK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ import UIKit

extension Extendable where Base: UITableView {
public func deselectRowIfNeeded(
with transitionCoordinator: UIViewControllerTransitionCoordinator? = nil,
animated: Bool = true,
after deadline: DispatchTime? = nil
) {
if let deadline {
DispatchQueue.main.asyncAfter(deadline: deadline) {
deselectRowIfNeeded(with: transitionCoordinator, animated: animated)
}
} else {
deselectRowIfNeeded(with: transitionCoordinator, animated: animated)
}
}

private func deselectRowIfNeeded(
with transitionCoordinator: UIViewControllerTransitionCoordinator?,
animated: Bool
) {
Expand All @@ -22,12 +36,12 @@ extension Extendable where Base: UITableView {
}

coordinator.animate(
alongsideTransition: { _ in
base.deselectRow(at: selectedIndexPath, animated: true)
alongsideTransition: { [weak base] _ in
base?.deselectRow(at: selectedIndexPath, animated: true)
},
completion: { context in
completion: { [weak base] context in
guard context.isCancelled else { return }
base.selectRow(at: selectedIndexPath, animated: false, scrollPosition: .none)
base?.selectRow(at: selectedIndexPath, animated: false, scrollPosition: .none)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension Extendable where Base: Layout.Section {
header: SupplementaryItem.Style? = nil,
footer: SupplementaryItem.Style? = nil,
decoration: DecorationStyle? = nil,
edgeInsets: SectionEdgeInsets
edgeInsets: SectionEdgeInsets?
) -> Base {
custom(
layoutEnvironment: environment,
Expand Down Expand Up @@ -78,7 +78,7 @@ extension Extendable where Base: Layout.Compositional {
header: SupplementaryItem.Style? = nil,
footer: SupplementaryItem.Style? = nil,
decoration: DecorationStyle? = nil,
edgeInsets: SectionEdgeInsets,
edgeInsets: SectionEdgeInsets?,
configuration: Layout.CompositionalConfiguration? = nil
) -> Base {
let sectionProvider: Layout.CompositionalSectionProvider = { _, environment in
Expand Down Expand Up @@ -121,7 +121,7 @@ extension SectionProviderWrapper {
header: SupplementaryItem.Style? = nil,
footer: SupplementaryItem.Style? = nil,
decoration: DecorationStyle? = nil,
edgeInsets: SectionEdgeInsets
edgeInsets: SectionEdgeInsets?
) -> Self {
.init {
Layout.Section.rak.list(
Expand Down
3 changes: 2 additions & 1 deletion Sources/Epoxy/Row/BaseStyledEpoxyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ open class BaseStyledEpoxyView<Style: Hashable>: RAKBase.BaseView, StyledView {

// MARK: Config

override open func config() {
@objc
override open dynamic func config() {
super.config()

translatesAutoresizingMaskIntoConstraints = false
Expand Down