-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from RakuyoKit/feature/epoxy
Feature/epoxy
- Loading branch information
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// UITableView+RAK.swift | ||
// RakuyoKit | ||
// | ||
// Created by Rakuyo on 2024/7/8. | ||
// Copyright © 2024 RakuyoKit. All rights reserved. | ||
// | ||
|
||
#if !os(watchOS) | ||
import UIKit | ||
|
||
extension Extendable where Base: UITableView { | ||
public func deselectRowIfNeeded( | ||
with transitionCoordinator: UIViewControllerTransitionCoordinator?, | ||
animated: Bool | ||
) { | ||
guard let selectedIndexPath = base.indexPathForSelectedRow else { return } | ||
|
||
guard let coordinator = transitionCoordinator else { | ||
base.deselectRow(at: selectedIndexPath, animated: animated) | ||
return | ||
} | ||
|
||
coordinator.animate( | ||
alongsideTransition: { _ in | ||
base.deselectRow(at: selectedIndexPath, animated: true) | ||
}, | ||
completion: { context in | ||
guard context.isCancelled else { return } | ||
base.selectRow(at: selectedIndexPath, animated: false, scrollPosition: .none) | ||
} | ||
) | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters