Skip to content

Instantly share code, notes, and snippets.

View RinniSwift's full-sized avatar
🔸
Swifting

Rinni Swift RinniSwift

🔸
Swifting
View GitHub Profile
class LRUCache<T: Hashable, U> {
// ...
/// Returns the element at the specified key. Nil if it doesn't exist.
func retrieveObject(at key: T) -> U? {
guard let existingNode = dictionary[key] else {
return nil
}
linkedList.moveToHead(node: existingNode)
let element = UIAccessibilityElement(accessibilityContainer: self)
element.accessibilityLabel = [titleLabel.text, subtitleLabel.text].compactmap { $0 }.joined(seperator: ", ")
element.accessibilityFrameInContainerSpace = titleLabel.frame.union(subtitleLabel.frame)
accessibilityElements = [element, bottomView, button].compactMap { $0 }
let callAction = UIAccessibilityCustomAction(
name: "Call",
target: self,
selector: #selector(callButtonPressed)
)
let emailAction = UIAccessibilityCustomAction(
name: "Send email",
target: self,
selector: #selector(emailButtonPressed)